class Rack::AcornCache

Attributes

configuration[RW]

Public Class Methods

configure() { |configuration| ... } click to toggle source
# File lib/acorn_cache/config.rb, line 6
def self.configure
  self.configuration ||= Configuration.new
  yield(configuration)
end
new(app) click to toggle source
# File lib/acorn_cache.rb, line 4
def initialize(app)
  @app = app
end

Public Instance Methods

_call(env) click to toggle source
# File lib/acorn_cache.rb, line 12
def _call(env)
  request = Request.new(env)
  return @app.call(env) unless request.cacheable?

  begin
    CacheController.new(request, @app).response.to_a
  rescue AppException => e
    raise e.caught_exception
  rescue => e
    @app.call(env)
  end
end
call(env) click to toggle source
# File lib/acorn_cache.rb, line 8
def call(env)
  dup._call(env)
end