Module: Cell::Caching::ClassMethods

Defined in:
lib/cell/caching.rb

Instance Method Summary collapse

Instance Method Details

#cache(state, *args, &block) ⇒ Object



22
23
24
25
26
27
28
# File 'lib/cell/caching.rb', line 22

def cache(state, *args, &block)
  options = args.extract_options!

  self.conditional_procs[state] = Uber::Options::Value.new(options.delete(:if) || true)
  self.version_procs[state] = Uber::Options::Value.new(args.first || block)
  self.cache_options[state] = Uber::Options.new(options)
end

#expire_cache_key_for(key, cache_store, *args) ⇒ Object



35
36
37
# File 'lib/cell/caching.rb', line 35

def expire_cache_key_for(key, cache_store, *args)
  cache_store.delete(key, *args)
end

#state_cache_key(state, key_parts = {}) ⇒ Object

Computes the complete, namespaced cache key for state.



31
32
33
# File 'lib/cell/caching.rb', line 31

def state_cache_key(state, key_parts={})
  expand_cache_key([controller_path, state, key_parts])
end