Guest User

Untitled

a guest
May 23rd, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 KB | None | 0 0
  1. # ---
  2. # Caching!
  3.  
  4. # THIS METHOD IS NOT IDEAL and was probably a bad idea. if a list of teams is pre-loaded via sql,
  5. # this method will go to memcached anyway, which is dumb. haven't been able to find away
  6. # around it. rails doesn't seem happy about me overriding a has_many association method.
  7. # probably need to rename this to affiliations_cached or something like that, and use it explicitly
  8. # when needed. will fix when i have time. bugzID 702.
  9.  
  10. # assuming that a team's primary affiliation, division, league,
  11. # conference, sport, and parent NEVER change,
  12. # and that affiliations themselves are NEVER updated.
  13. # if we ever need to reset these, then we can do so by updating Team's or Affiliation's
  14. # class-level version
  15. alias_method :uncached_affiliations, :affiliations
  16. def affiliations
  17. get_cache("affiliations:#{self.cache_config[:version]}:#{Affiliation.cache_config[:version]}") do
  18. uncached_affiliations
  19. end
  20. end
  21.  
  22. # ---
Add Comment
Please, Sign In to add comment