Sha256: db8393658547e22dd8006666340bb1582d541400613b8ae0b5e6ddec973b6c76

Contents?: true

Size: 1.6 KB

Versions: 4

Compression:

Stored size: 1.6 KB

Contents

require 'fileutils'
require 'time'
require 'rack'

module Rack #:nodoc:
end

# = HTTP Caching For Rack
#
# Rack::Cache is suitable as a quick, drop-in component to enable HTTP caching
# for Rack-enabled applications that produce freshness (+Expires+, +Cache-Control+)
# and/or validation (+Last-Modified+, +ETag+) information.
#
# * Standards-based (RFC 2616 compliance)
# * Freshness/expiration based caching and validation
# * Supports HTTP Vary
# * Portable: 100% Ruby / works with any Rack-enabled framework
# * VCL-like configuration language for advanced caching policies
# * Disk, memcached, and heap memory storage backends
#
# === Usage
#
# Create with default options:
#   require 'rack/cache'
#   Rack::Cache.new(app, :verbose => true, :entitystore => 'file:cache')
#
# Within a rackup file (or with Rack::Builder):
#   require 'rack/cache'
#   use Rack::Cache do
#     set :verbose, true
#     set :metastore, 'memcached://localhost:11211/meta'
#     set :entitystore, 'file:/var/cache/rack'
#   end
#   run app
#
module Rack::Cache
  require 'rack/cache/request'
  require 'rack/cache/response'
  require 'rack/cache/context'
  require 'rack/cache/storage'

  # Create a new Rack::Cache middleware component that fetches resources from
  # the specified backend application. The +options+ Hash can be used to
  # specify default configuration values (see attributes defined in
  # Rack::Cache::Options for possible key/values). When a block is given, it
  # is executed within the context of the newly create Rack::Cache::Context
  # object.
  def self.new(backend, options={}, &b)
    Context.new(backend, options, &b)
  end
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
rtomayko-rack-cache-0.2.0 lib/rack/cache.rb
rtomayko-rack-cache-0.3.0 lib/rack/cache.rb
rack-cache-0.2.0 lib/rack/cache.rb
rack-cache-0.3.0 lib/rack/cache.rb