module Cell::Caching::ClassMethods

Public Instance Methods

cache(state, *args, &block) click to toggle source
# File lib/cell/caching.rb, line 20
def cache(state, *args, &block)
  options = args.last.is_a?(Hash) ? args.pop : {} # I have to admit, Array#extract_options is a brilliant tool.

  conditional_procs[state] = Declarative::Option(options.delete(:if) || true, instance_exec: true)
  version_procs[state]     = Declarative::Option(args.first || block, instance_exec: true)
  cache_options[state]     = Declarative::Options(options, instance_exec: true)
end
expire_cache_key_for(key, cache_store, *args) click to toggle source
# 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={}) click to toggle source

Computes the complete, namespaced cache key for state.

# File lib/cell/caching.rb, line 29
def state_cache_key(state, key_parts={})
  expand_cache_key([controller_path, state, key_parts])
end

Private Instance Methods

expand_cache_key(key) click to toggle source
# File lib/cell/caching.rb, line 39
def expand_cache_key(key)
  key.join("/")
end