Cachoo
Expirable memoization of methods
Installation
gem install cachooUsage
class Cache
extend Cachoo
def now
Time.now.utc
end
cachoo :now # :now gets cached for 5 seconds by default
endclass Cache
extend Cachoo
def now
Time.now.utc
end
cachoo :now, for: 60*60 # :now get cached for 1 hour
endYou can also ahange the time globally:
Cachoo.for = 60*60*24 # 1 day cacheWhy?
I hate manually expiring memoization
Name
It's an invented word betweeh cache and achoo :)