Class: Rack::Cache::Context

Inherits:
Object
  • Object
show all
Includes:
AsyncRack::AsyncCallback::Mixin
Defined in:
lib/beats/rack/cache.rb

Direct Known Subclasses

Beats::Rack::Cache

Instance Method Summary collapse

Instance Method Details

#async_callback(result) ⇒ Object



10
11
12
13
14
15
# File 'lib/beats/rack/cache.rb', line 10

def async_callback(result)
  response = Response.new(*result)
  @request ||= Request.new(env.dup.freeze)
  store response if response.cacheable?
  super result
end

#call(env) ⇒ Object



17
18
19
20
21
22
23
24
# File 'lib/beats/rack/cache.rb', line 17

def call(env)
  setup_async env
  if env['rack.run_once']
    call! env
  else
    clone.call! env
  end
end