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



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

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



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

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