Class: Garner::Middleware::Cache::Bust Abstract
- Defined in:
- lib/garner/middleware/cache/bust.rb
Overview
This class is abstract.
Add the necessary Cache-Control and Expires headers to bust client cache.
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
Methods inherited from Base
#before, #call, #call!, #default_options, #initialize, #request, #response
Constructor Details
This class inherits a constructor from Garner::Middleware::Base
Instance Method Details
#after ⇒ Object
7 8 9 10 11 12 13 14 15 |
# File 'lib/garner/middleware/cache/bust.rb', line 7 def after # private: ok to store API results in a private cache # max-age: don't reuse the cached result without checking with the server (server might say 304 Not Modified) # must-revalidate: prevent gateways from returning a response if the API server is not reachable @app_response[1]["Cache-Control"] = "private, max-age=0, must-revalidate" # don't reuse the cached result without checking with the server @app_response[1]["Expires"] = "Fri, 01 Jan 1990 00:00:00 GMT" @app_response end |