→ Cache Bang

14 December 2009

My favorite caching idiom:

def rankings
  # return cached data or call `rankings!`
  cache(:rankings!)
end

def rankings!
  # compute expensive rankings
end

Smoke 'em if you got 'em.