Class: Adsf::Rack::Caching
- Inherits:
-
Object
- Object
- Adsf::Rack::Caching
- Defined in:
- lib/adsf/rack/caching.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app) ⇒ Caching
constructor
A new instance of Caching.
Constructor Details
#initialize(app) ⇒ Caching
Returns a new instance of Caching.
5 6 7 |
# File 'lib/adsf/rack/caching.rb', line 5 def initialize(app) @app = app end |
Instance Method Details
#call(env) ⇒ Object
9 10 11 12 13 14 15 16 17 18 |
# File 'lib/adsf/rack/caching.rb', line 9 def call(env) status, headers, body = *@app.call(env) new_headers = headers.merge( 'cache-control' => 'max-age=0, stale-if-error=0', ) [status, new_headers, body] end |