github
Advanced Search
  • Home
  • Pricing and Signup
  • Explore GitHub
  • Blog
  • Login

rtomayko / rack-cache

  • Admin
  • Watch Unwatch
  • Fork
  • Your Fork
  • Pull Request
  • Download Source
    • 220
    • 15
  • Source
  • Commits
  • Network (15)
  • Issues (4)
  • Graphs
  • Branch: master

click here to add a description

click here to add a homepage

  • Branches (1)
    • master ✓
  • Tags (4)
    • 0.5.0
    • 0.4.0
    • 0.3.0
    • 0.2.0
Sending Request…
Enable Donations

Pledgie Donations

Once activated, we'll place the following badge in your repository's detail box:
Pledgie_example
This service is courtesy of Pledgie.

Real HTTP Caching for Ruby Web Apps — Read more

  cancel

http://tomayko.com/src/rack-cache/

  cancel
  • Private
  • Read-Only
  • HTTP Read-Only

This URL has Read+Write access

Merge baroquebobcat/master 
rtomayko (author)
Mon Jan 18 21:08:00 -0800 2010
commit  81482388db7d49f85f45c1d9d9167220bc6ca65f
tree    7f30ee173f2ec0336ac2e84523062d19d5fb001d
parent  33ca6339c1663f3719c17e45586a9d932854f632 parent  cf2cc74940055bbac902e1ca4e473a9732833c23
rack-cache /
name age
history
message
file .autotest Sun Oct 19 22:24:22 -0700 2008 add DiskBackedMemory store; other small tweaks ... [rtomayko]
file .gitignore Sun Oct 19 22:24:34 -0700 2008 documentation system + documentation [rtomayko]
file CHANGES Sat Jun 06 00:01:02 -0700 2009 Advanced memcached config, including server clu... [rtomayko]
file COPYING Sun Oct 19 22:24:34 -0700 2008 documentation system + documentation [rtomayko]
file README Mon Mar 16 10:27:23 -0700 2009 0.4 release [rtomayko]
file Rakefile Fri Sep 25 21:33:36 -0700 2009 add gemcutter release tasks [rtomayko]
file TODO Tue Mar 31 06:28:13 -0700 2009 Update TODO with stuff planned for 0.5 release [rtomayko]
directory doc/ Mon May 25 06:40:46 -0700 2009 Fix bad config examples in storage docs [rtomayko]
directory example/ Wed Feb 04 03:32:05 -0800 2009 Example Sinatra app [nakajima]
directory lib/ Tue Jan 12 19:21:08 -0800 2010 added to_i to status to handle cases where mid... [Nick Howard]
file rack-cache.gemspec Tue Jan 12 19:08:06 -0800 2010 added test-spec to gemspec as dev dependency [Nick Howard]
directory test/ Tue Jan 12 19:21:08 -0800 2010 added to_i to status to handle cases where mid... [Nick Howard]
README
Rack::Cache
===========

Rack::Cache is suitable as a quick drop-in component to enable HTTP caching for
Rack-based applications that produce freshness (Expires, Cache-Control) and/or
validation (Last-Modified, ETag) information:

  * Standards-based (RFC 2616)
  * Freshness/expiration based caching
  * Validation (If-Modified-Since / If-None-Match)
  * Vary support
  * Cache-Control: public, private, max-age, s-maxage, must-revalidate,
    and proxy-revalidate.
  * Portable: 100% Ruby / works with any Rack-enabled framework
  * Disk, memcached, and heap memory storage backends

For more information about Rack::Cache features and usage, see:

http://tomayko.com/src/rack-cache/

Rack::Cache is not overly optimized for performance. The main goal of the
project is to provide a portable, easy-to-configure, and standards-based
caching solution for small to medium sized deployments. More sophisticated /
high-performance caching systems (e.g., Varnish, Squid, httpd/mod-cache) may be
more appropriate for large deployments with significant throughput requirements.

Installation
------------

From Gem:

    $ sudo gem install rack-cache

With a local working copy:

    $ git clone git://github.com/rtomayko/rack-cache.git
    $ rake package && sudo rake install

Basic Usage
-----------

Rack::Cache is implemented as a piece of Rack middleware and can be used with
any Rack-based application. If your application includes a rackup (`.ru`) file
or uses Rack::Builder to construct the application pipeline, simply require
and use as follows:

    require 'rack/cache'

    use Rack::Cache,
      :metastore   => 'file:/var/cache/rack/meta',
      :entitystore => 'file:/var/cache/rack/body',
      :verbose     => true

    run app

Assuming you've designed your backend application to take advantage of HTTP's
caching features, no further code or configuration is required for basic
caching.

Using with Rails
----------------

Add this to your `config/environment.rb`:

   config.middleware.use Rack::Cache,
       :verbose => true,
       :metastore   => 'file:/var/cache/rack/meta',
       :entitystore => 'file:/var/cache/rack/body'

You should now see `Rack::Cache` listed in the middleware pipeline:

    rake middleware

See the following for more information:

    http://snippets.aktagon.com/snippets/302

Links
-----

Documentation:
    http://tomayko.com/src/rack-cache/

Mailing List:
    http://groups.google.com/group/rack-cache

GitHub:
    http://github.com/rtomayko/rack-cache/

License
-------

Copyright (c) 2008 Ryan Tomayko <http://tomayko.com/about>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Blog | Support | Training | Contact | API | Status | Twitter | Help | Security
© 2010 GitHub Inc. All rights reserved. | Terms of Service | Privacy Policy
Powered by the Dedicated Servers and
Cloud Computing of Rackspace Hosting®
Dedicated Server