Class: Mongo::QueryCache::Middleware
- Inherits:
-
Object
- Object
- Mongo::QueryCache::Middleware
- Defined in:
- lib/mongo/query_cache.rb
Overview
Rack middleware that activates the query cache for each request.
Defined Under Namespace
Modules: ActiveJob
Instance Method Summary collapse
-
#call(env) ⇒ Object
Enable query cache and execute the request.
-
#initialize(app) ⇒ Middleware
constructor
Instantiate the middleware.
Constructor Details
#initialize(app) ⇒ Middleware
Instantiate the middleware.
256 257 258 |
# File 'lib/mongo/query_cache.rb', line 256 def initialize(app) @app = app end |
Instance Method Details
#call(env) ⇒ Object
Enable query cache and execute the request.
268 269 270 271 272 273 274 |
# File 'lib/mongo/query_cache.rb', line 268 def call(env) QueryCache.cache do @app.call(env) end ensure QueryCache.clear end |