Class: Workarea::Elasticsearch::QueryCache::Middleware
- Inherits:
-
Object
- Object
- Workarea::Elasticsearch::QueryCache::Middleware
- Defined in:
- lib/workarea/elasticsearch/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.
86 87 88 |
# File 'lib/workarea/elasticsearch/query_cache.rb', line 86 def initialize(app) @app = app end |
Instance Method Details
#call(env) ⇒ Object
Execute the request, wrapping in a query cache.
98 99 100 101 102 |
# File 'lib/workarea/elasticsearch/query_cache.rb', line 98 def call(env) QueryCache.cache { @app.call(env) } ensure QueryCache.clear_cache end |