Method: Cardiac::Model::CacheDecoration::ClassMethods#cache_all!

Defined in:
lib/cardiac/model/cache_decoration.rb

#cache_all!(options = {}) ⇒ Object

Causes all find(..) methods to go through an object-level cache, which is populated on demand whenever it is needed.

Pass false to uninstall the model cache.



17
18
19
20
21
22
23
24
25
# File 'lib/cardiac/model/cache_decoration.rb', line 17

def cache_all! options={}
  if options
    @_model_cache_control = (Hash===options ? options : {}).update(expires_at: Time.now)
    __operation_proxy__.__adapter__.after_execute MODEL_CACHE_CONTROL_PROC
  else
    @model_cache = @_model_cache_control = nil
    __operation_proxy__.__adapter__.skip_callback :execute, :after,  MODEL_CACHE_CONTROL_PROC
  end
end