Class: Arturo::FeatureCaching::AllStrategy
- Inherits:
-
Object
- Object
- Arturo::FeatureCaching::AllStrategy
- Defined in:
- lib/arturo/feature_caching.rb
Class Method Summary collapse
Class Method Details
.expire(cache, symbol) ⇒ Object
68 69 70 |
# File 'lib/arturo/feature_caching.rb', line 68 def expire(cache, symbol) cache.delete("arturo.all") end |
.fetch(cache, symbol, &block) ⇒ Object
56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/arturo/feature_caching.rb', line 56 def fetch(cache, symbol, &block) features = cache.read("arturo.all") unless cache_is_current?(cache, features) features = Hash[Arturo::Feature.all.map { |f| [f.symbol.to_sym, f] }] mark_as_current!(cache) cache.write("arturo.all", features, :expires_in => Arturo::Feature.cache_ttl * 10) end features[symbol] || Arturo::NoSuchFeature.new(symbol) end |