Class: Mongoid::QueryCache::Middleware
- Inherits:
-
Object
- Object
- Mongoid::QueryCache::Middleware
- Defined in:
- lib/mongoid/query_cache.rb
Overview
The middleware to be added to a rack application in order to activate the query cache.
Instance Method Summary collapse
-
#call(env) ⇒ Object
Execute the request, wrapping in a query cache.
-
#initialize(app) ⇒ Middleware
constructor
Instantiate the middleware.
Constructor Details
#initialize(app) ⇒ Middleware
Instantiate the middleware.
103 104 105 |
# File 'lib/mongoid/query_cache.rb', line 103 def initialize(app) @app = app end |
Instance Method Details
#call(env) ⇒ Object
Execute the request, wrapping in a query cache.
117 118 119 120 121 |
# File 'lib/mongoid/query_cache.rb', line 117 def call(env) QueryCache.cache { @app.call(env) } ensure QueryCache.clear_cache end |