Class: Subflag::Rails::RequestCache::Middleware
- Inherits:
-
Object
- Object
- Subflag::Rails::RequestCache::Middleware
- Defined in:
- lib/subflag/rails/request_cache.rb
Overview
Rack middleware for per-request caching
Wraps each request in a cache scope so flag evaluations are cached for the duration of the request.
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app) ⇒ Middleware
constructor
A new instance of Middleware.
Constructor Details
#initialize(app) ⇒ Middleware
Returns a new instance of Middleware.
67 68 69 |
# File 'lib/subflag/rails/request_cache.rb', line 67 def initialize(app) @app = app end |
Instance Method Details
#call(env) ⇒ Object
71 72 73 74 75 76 |
# File 'lib/subflag/rails/request_cache.rb', line 71 def call(env) RequestCache.start @app.call(env) ensure RequestCache.clear end |