Module: Rack::Cache

### Home Classes Methods

### In Files

- lib/rack/cache.rb
- lib/rack/cache/cachecontrol.rb
- lib/rack/cache/context.rb
- lib/rack/cache/entitystore.rb
- lib/rack/cache/key.rb
- lib/rack/cache/metastore.rb
- lib/rack/cache/options.rb
- lib/rack/cache/request.rb
- lib/rack/cache/response.rb
- lib/rack/cache/storage.rb

### Namespace

- MODULE Rack::Cache::AppEngine
- MODULE Rack::Cache::Options
- CLASS Rack::Cache::CacheControl
- CLASS Rack::Cache::Context
- CLASS Rack::Cache::EntityStore
- CLASS Rack::Cache::Key
- CLASS Rack::Cache::MetaStore
- CLASS Rack::Cache::Request
- CLASS Rack::Cache::Response
- CLASS Rack::Cache::Storage

### Methods

- ::new

### Files

- CHANGES
- COPYING
- README
- TODO

### Class/Module Index

Quicksearch

- Rack
- Rack::Cache
- Rack::Cache::AppEngine
- Rack::Cache::AppEngine::MC
- Rack::Cache::AppEngine::MemCache
- Rack::Cache::CacheControl
- Rack::Cache::Context
- Rack::Cache::EntityStore
- Rack::Cache::EntityStore::DISK
- Rack::Cache::EntityStore::Dalli
- Rack::Cache::EntityStore::Disk
- Rack::Cache::EntityStore::FILE
- Rack::Cache::EntityStore::GAE
- Rack::Cache::EntityStore::GAECACHE
- Rack::Cache::EntityStore::GAEStore
- Rack::Cache::EntityStore::HEAP
- Rack::Cache::EntityStore::Heap
- Rack::Cache::EntityStore::MEM
- Rack::Cache::EntityStore::MemCacheBase
- Rack::Cache::EntityStore::MemCached
- Rack::Cache::Key
- Rack::Cache::MetaStore
- Rack::Cache::MetaStore::DISK
- Rack::Cache::MetaStore::Dalli
- Rack::Cache::MetaStore::Disk
- Rack::Cache::MetaStore::FILE
- Rack::Cache::MetaStore::GAE
- Rack::Cache::MetaStore::GAECACHE
- Rack::Cache::MetaStore::GAEStore
- Rack::Cache::MetaStore::HEAP
- Rack::Cache::MetaStore::Heap
- Rack::Cache::MetaStore::MEM
- Rack::Cache::MetaStore::MemCacheBase
- Rack::Cache::MetaStore::MemCached
- Rack::Cache::Options
- Rack::Cache::Request
- Rack::Cache::Response
- Rack::Cache::Storage

No matching classes.

# Rack::Cache

# 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

- 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

### Public Class Methods

new(backend, options={}, &b) click to toggle source

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.

    # File lib/rack/cache.rb, line 42
    def self.new(backend, options={}, &b)
      Context.new(backend, options, &b)
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.