Module: ManageCache::ClassMethods

Defined in:
lib/manage_cache.rb

Instance Method Summary collapse

Instance Method Details

#manage_cache_for(keys_specs = {}) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/manage_cache.rb', line 8

def manage_cache_for(keys_specs={})
  #
  # cache_keys_specs is an Array of Hashes, each specifying one cache_key
  # see prepare_cache_key-method below for options to be used
  #
  cattr_accessor :cache_keys_specs
  self.cache_keys_specs = keys_specs

  before_save    { |record| record.dump_cache! }
  before_destroy { |record| record.dump_cache! }

  include ManageCache::LocalInstanceMethods
end