class Rack::PageCaching

Constants

VERSION

Attributes

environment[RW]

Public Class Methods

new(app, options = {}) click to toggle source
# File lib/rack/page_caching.rb, line 17
def initialize(app, options = {})
  @app = app
  self.class.environment = Rack::PageCaching::Environment.new(options)
end

Public Instance Methods

call(env) click to toggle source
# File lib/rack/page_caching.rb, line 22
def call(env)
  rack_response = @app.call(env)
  if self.class.environment.enabled?
    response = Rack::PageCaching::Response.new(rack_response, env)
    Rack::PageCaching::Cache.store(response) if response.cacheable?
  end
  rack_response
end