Sha256: bf30b8c0751a0d4fe6765961e7dfa06666d315655ddbd9566d31a2f1a2e25c91
Contents?: true
Size: 917 Bytes
Versions: 3
Compression:
Stored size: 917 Bytes
Contents
require "rack/page_caching/version" require "rack/page_caching/utils" require "rack/page_caching/environment" require "rack/page_caching/response" require "rack/page_caching/cache" require "rack/page_caching/mime_types" require "rack/page_caching/action_controller" if defined?(::Rails) module Rack class PageCaching MimeTypes.load! MimeTypes.register 'text/html', '.html' MimeTypes.register 'text/plain', '.txt' def initialize(app, options = {}) @app = app self.class.environment = Rack::PageCaching::Environment.new(options) end 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 class << self attr_accessor :environment end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
rack-page_caching-0.0.3 | lib/rack/page_caching.rb |
rack-page_caching-0.0.2 | lib/rack/page_caching.rb |
rack-page_caching-0.0.1 | lib/rack/page_caching.rb |