Module: SecondLevelCache::Mixin
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/second_level_cache/mixin.rb
Defined Under Namespace
Modules: ClassMethods
Instance Method Summary collapse
- #expire_second_level_cache ⇒ Object
- #klass ⇒ Object
- #second_level_cache_key ⇒ Object
- #write_second_level_cache ⇒ Object (also: #update_second_level_cache)
Instance Method Details
#expire_second_level_cache ⇒ Object
67 68 69 70 |
# File 'lib/second_level_cache/mixin.rb', line 67 def expire_second_level_cache return unless klass.second_level_cache_enabled? SecondLevelCache.cache_store.delete(second_level_cache_key) end |
#klass ⇒ Object
63 64 65 |
# File 'lib/second_level_cache/mixin.rb', line 63 def klass self.class.base_class end |
#second_level_cache_key ⇒ Object
59 60 61 |
# File 'lib/second_level_cache/mixin.rb', line 59 def second_level_cache_key klass.second_level_cache_key(id) end |
#write_second_level_cache ⇒ Object Also known as: update_second_level_cache
72 73 74 75 76 77 78 |
# File 'lib/second_level_cache/mixin.rb', line 72 def write_second_level_cache return unless klass.second_level_cache_enabled? marshal = RecordMarshal.dump(self) expires_in = klass.[:expires_in] SecondLevelCache.cache_store.write(second_level_cache_key, marshal, expires_in: expires_in) end |