Module: CacheProxy::Common
- Included in:
- ClassMethods, InstanceMethods
- Defined in:
- lib/cache_proxy.rb
Instance Method Summary collapse
Instance Method Details
#cache_proxy(key, options = {}, &block) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/cache_proxy.rb', line 10 def cache_proxy(key, = {}, &block) .reverse_merge!({ :cached => true, :cache_expires_in => 30.days }) repository = [:repository] || Rails.cache if [:cached] repository.fetch(key, :expires_in => [:cache_expires_in], &block) else yield end end |