Module: Cell::Caching
Defined Under Namespace
Modules: ClassMethods, Notifications
Instance Attribute Summary collapse
-
#cache_configured ⇒ Object
writeonly
Sets the attribute cache_configured.
-
#cache_store ⇒ Object
we want to use DI to set a cache store in cell/rails.
Instance Method Summary collapse
Instance Attribute Details
#cache_configured=(value) ⇒ Object (writeonly)
Sets the attribute cache_configured
59 60 61 |
# File 'lib/cell/caching.rb', line 59 def cache_configured=(value) @cache_configured = value end |
#cache_store ⇒ Object
we want to use DI to set a cache store in cell/rails.
61 62 63 |
# File 'lib/cell/caching.rb', line 61 def cache_store @cache_store end |
Instance Method Details
#cache?(state, *args) ⇒ Boolean
63 64 65 |
# File 'lib/cell/caching.rb', line 63 def cache?(state, *args) cache_configured? and state_cached?(state) and self.class.conditional_procs[state].evaluate(self, *args) end |
#cache_configured? ⇒ Boolean
56 57 58 |
# File 'lib/cell/caching.rb', line 56 def cache_configured? @cache_configured end |
#render_state(state, *args) ⇒ Object
47 48 49 50 51 52 53 54 |
# File 'lib/cell/caching.rb', line 47 def render_state(state, *args) return super(state, *args) unless cache?(state, *args) key = self.class.state_cache_key(state, self.class.version_procs[state].evaluate(self, *args)) = self.class..eval(state, self, *args) fetch_from_cache_for(key, ) { super(state, *args) } end |