Middleware — Documentation by YARD 0.9.37 (original) (raw)

Class: Mongo::QueryCache::Middleware

Inherits:

Object

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 Summarycollapse

Constructor Details

#initialize(app) ⇒ Middleware

Instantiate the middleware.

264 265 266 # 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.

276 277 278 279 280 281 282 # File 'lib/mongo/query_cache.rb', line 276 def call(env) QueryCache.cache do @app.call(env) end ensure QueryCache.clear end