Class: RocketPants::CacheMiddleware
- Inherits:
-
Object
- Object
- RocketPants::CacheMiddleware
- Defined in:
- lib/rocket_pants/cache_middleware.rb
Constant Summary collapse
- NOT_MODIFIED =
[304, {}, []]
- DIVIDER =
":"
Instance Method Summary collapse
- #_call(env) ⇒ Object
- #call(env) ⇒ Object
-
#initialize(app) ⇒ CacheMiddleware
constructor
A new instance of CacheMiddleware.
Constructor Details
#initialize(app) ⇒ CacheMiddleware
Returns a new instance of CacheMiddleware.
7 8 9 |
# File 'lib/rocket_pants/cache_middleware.rb', line 7 def initialize(app) @app = app end |
Instance Method Details
#_call(env) ⇒ Object
15 16 17 18 19 20 21 22 23 |
# File 'lib/rocket_pants/cache_middleware.rb', line 15 def _call(env) @env = env if has_valid_etag? debug "Cache key is valid, returning not modified response." NOT_MODIFIED.dup else @app.call env end end |
#call(env) ⇒ Object
11 12 13 |
# File 'lib/rocket_pants/cache_middleware.rb', line 11 def call(env) dup._call env end |