Class: Fino::Rails::RequestScopedCache::Middleware

Inherits:
Object
  • Object
show all
Defined in:
lib/fino/rails/request_scoped_cache/middleware.rb

Instance Method Summary collapse

Constructor Details

#initialize(app, options = {}) ⇒ Middleware

Returns a new instance of Middleware.



4
5
6
7
# File 'lib/fino/rails/request_scoped_cache/middleware.rb', line 4

def initialize(app, options = {})
  @app = app
  @cache_wrapper_block = options[:cache_wrapper_block]
end

Instance Method Details

#call(env) ⇒ Object



9
10
11
12
13
# File 'lib/fino/rails/request_scoped_cache/middleware.rb', line 9

def call(env)
  Fino::Rails::RequestScopedCache::Pipe.with_temporary_cache(@cache_wrapper_block) do
    @app.call(env)
  end
end