Class: Mongo::QueryCache::Middleware
Relationships & Source Files | |
Namespace Children | |
Modules:
| |
Inherits: | Object |
Defined in: | lib/mongo/query_cache.rb |
Overview
Rack middleware that activates the query cache for each request.
Class Method Summary
-
.new(app) ⇒ Middleware
constructor
Instantiate the middleware.
Instance Method Summary
-
#call(env) ⇒ Object
Enable query cache and execute the request.
Constructor Details
.new(app) ⇒ Middleware
Instantiate the middleware.
# File 'lib/mongo/query_cache.rb', line 264
def initialize(app) @app = app end
Instance Method Details
#call(env) ⇒ Object
Enable query cache and execute the request.
# File 'lib/mongo/query_cache.rb', line 276
def call(env) QueryCache.cache do @app.call(env) end ensure QueryCache.clear end