Module: Garner::Cache
- Defined in:
- lib/garner/cache.rb,
lib/garner/cache/binding.rb,
lib/garner/cache/context.rb,
lib/garner/cache/identity.rb
Defined Under Namespace
Modules: Binding, Context Classes: Identity
Class Method Summary collapse
-
.fetch(bindings, key_hash, options_hash, &block) ⇒ Object
Fetch a result from cache.
Class Method Details
.fetch(bindings, key_hash, options_hash, &block) ⇒ Object
Fetch a result from cache.
10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/garner/cache.rb', line 10 def self.fetch(bindings, key_hash, , &block) if (compound_key = compound_key(bindings, key_hash)) result = Garner.config.cache.fetch(compound_key, ) do yield end Garner.config.cache.delete(compound_key) unless result else result = yield end result end |