Module: Cell::Caching::ClassMethods
- Defined in:
- lib/cell/caching.rb
Instance Method Summary collapse
- #cache(state, *args, &block) ⇒ Object
- #expire_cache_key_for(key, cache_store, *args) ⇒ Object
-
#state_cache_key(state, key_parts = {}) ⇒ Object
Computes the complete, namespaced cache key for
state
.
Instance Method Details
#cache(state, *args, &block) ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/cell/caching.rb', line 20 def cache(state, *args, &block) = args.last.is_a?(Hash) ? args.pop : {} # I have to admit, Array#extract_options is a brilliant tool. conditional_procs[state] = Declarative::Option(.delete(:if) || true, instance_exec: true) version_procs[state] = Declarative::Option(args.first || block, instance_exec: true) [state] = Declarative::Options(, instance_exec: true) end |
#expire_cache_key_for(key, cache_store, *args) ⇒ Object
33 34 35 |
# File 'lib/cell/caching.rb', line 33 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
.
29 30 31 |
# File 'lib/cell/caching.rb', line 29 def state_cache_key(state, key_parts={}) ([controller_path, state, key_parts]) end |