Method: Cardiac::Model::CacheDecoration::ClassMethods#_model_cache_control
- Defined in:
- lib/cardiac/model/cache_decoration.rb
#_model_cache_control(response) ⇒ Object
Internal method that controls the model cache, using the given response object.
28 29 30 31 32 33 34 35 |
# File 'lib/cardiac/model/cache_decoration.rb', line 28 def _model_cache_control(response) response = Rack::Cache::Response.new(*response.to_a) if response.fresh? @_model_cache_control[:expires_at] = response.expires || (response.date + response.ttl) else @_model_cache_control[:expires_at] = Time.now end end |