Method: ActiveSupport::Cache::Strategy::LocalCache::Middleware#call

Defined in:
lib/active_support/cache/strategy/local_cache_middleware.rb

#call(env) ⇒ Object



27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/active_support/cache/strategy/local_cache_middleware.rb', line 27

def call(env)
  LocalCacheRegistry.set_cache_for(local_cache_key, LocalStore.new)
  response = @app.call(env)
  response[2] = ::Rack::BodyProxy.new(response[2]) do
    LocalCacheRegistry.set_cache_for(local_cache_key, nil)
  end
  cleanup_on_body_close = true
  response
rescue Rack::Utils::InvalidParameterError
  [400, {}, []]
ensure
  LocalCacheRegistry.set_cache_for(local_cache_key, nil) unless
    cleanup_on_body_close
end