Module: ManageCache::LocalInstanceMethods
- Defined in:
- lib/manage_cache.rb
Instance Method Summary collapse
Instance Method Details
#cache_key_for(spec) ⇒ Object
39 40 41 42 |
# File 'lib/manage_cache.rb', line 39 def cache_key_for(spec) instance_variable_get("@cache_key_for_#{spec}") || instance_variable_set("@cache_key_for_#{spec}", prepare_cache_key(spec)) end |
#dump_cache! ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/manage_cache.rb', line 24 def dump_cache! self.class.cache_keys_specs.each do |k,v| # the rails helper method 'cache (name, opts) do ...' # adds some extras to the cache key. # To run with this gem, you have to add 'skip_digest: true'. # Any other options will prevent correct cache deletion!! # [cache_key_for(k), "views/#{cache_key_for(k)}"].each do |key| Rails.cache.delete(key) end instance_variable_set("@cache_key_for_#{k}", nil) end end |