Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 127 lines (89 sloc) 3.949 kb
5b59ea2e »
2008-10-18 documentation system + documentation
1 Rack::Cache
2 ===========
3
3381abcd »
2008-10-24 tidy things up a bit for release
4 Rack::Cache is suitable as a quick drop-in component to enable HTTP caching for
5 Rack-based applications that produce freshness (Expires, Cache-Control) and/or
12c17659 »
2008-11-24 add links to "Things Caches Do" in doc; update README
6 validation (Last-Modified, ETag) information:
5b59ea2e »
2008-10-18 documentation system + documentation
7
3381abcd »
2008-10-24 tidy things up a bit for release
8 * Standards-based (RFC 2616)
9 * Freshness/expiration based caching
12bd534f »
2008-12-28 doc and gemspec updates for 0.3.0
10 * Validation (If-Modified-Since / If-None-Match)
3381abcd »
2008-10-24 tidy things up a bit for release
11 * Vary support
12bd534f »
2008-12-28 doc and gemspec updates for 0.3.0
12 * Cache-Control: public, private, max-age, s-maxage, must-revalidate,
13 and proxy-revalidate.
5b59ea2e »
2008-10-18 documentation system + documentation
14 * Portable: 100% Ruby / works with any Rack-enabled framework
15 * Disk, memcached, and heap memory storage backends
16
17 For more information about Rack::Cache features and usage, see:
18
19 http://tomayko.com/src/rack-cache/
20
21 Rack::Cache is not overly optimized for performance. The main goal of the
22 project is to provide a portable, easy-to-configure, and standards-based
23 caching solution for small to medium sized deployments. More sophisticated /
3381abcd »
2008-10-24 tidy things up a bit for release
24 high-performance caching systems (e.g., Varnish, Squid, httpd/mod-cache) may be
25 more appropriate for large deployments with significant throughput requirements.
5b59ea2e »
2008-10-18 documentation system + documentation
26
27 Installation
28 ------------
29
30 From Gem:
31
32 $ sudo gem install rack-cache
33
34 With a local working copy:
35
36 $ git clone git://github.com/rtomayko/rack-cache.git
37 $ rake package && sudo rake install
38
39 Basic Usage
40 -----------
41
42 Rack::Cache is implemented as a piece of Rack middleware and can be used with
43 any Rack-based application. If your application includes a rackup (`.ru`) file
44 or uses Rack::Builder to construct the application pipeline, simply require
45 and use as follows:
46
47 require 'rack/cache'
3381abcd »
2008-10-24 tidy things up a bit for release
48
49 use Rack::Cache,
50 :metastore => 'file:/var/cache/rack/meta',
51 :entitystore => 'file:/var/cache/rack/body',
52 :verbose => true
53
5b59ea2e »
2008-10-18 documentation system + documentation
54 run app
55
56 Assuming you've designed your backend application to take advantage of HTTP's
57 caching features, no further code or configuration is required for basic
58 caching.
59
522dc31a »
2009-03-16 0.4 release
60 Using with Rails
61 ----------------
62
63 Add this to your `config/environment.rb`:
64
65 config.middleware.use Rack::Cache,
66 :verbose => true,
67 :metastore => 'file:/var/cache/rack/meta',
68 :entitystore => 'file:/var/cache/rack/body'
69
70 You should now see `Rack::Cache` listed in the middleware pipeline:
71
72 rake middleware
73
74 See the following for more information:
75
76 http://snippets.aktagon.com/snippets/302
77
c2dfe51c »
2010-12-24 add info about using Dalli to README
78 Using with Dalli
79 ----------------
80
81 Dalli is a high performance memcached client for Ruby.
82 More information at: https://github.com/mperham/dalli
83
84 require 'dalli'
85 require 'rack/cache'
86
87 use Rack::Cache,
88 :verbose => true,
89 :metastore => "memcached://localhost:11211/meta",
90 :entitystore => "memcached://localhost:11211/body"
91
92 run app
93
12bd534f »
2008-12-28 doc and gemspec updates for 0.3.0
94 Links
95 -----
5b59ea2e »
2008-10-18 documentation system + documentation
96
12bd534f »
2008-12-28 doc and gemspec updates for 0.3.0
97 Documentation:
98 http://tomayko.com/src/rack-cache/
99
100 Mailing List:
101 http://groups.google.com/group/rack-cache
102
103 GitHub:
104 http://github.com/rtomayko/rack-cache/
5b59ea2e »
2008-10-18 documentation system + documentation
105
106 License
107 -------
108
109 Copyright (c) 2008 Ryan Tomayko <http://tomayko.com/about>
110
111 Permission is hereby granted, free of charge, to any person obtaining a copy
112 of this software and associated documentation files (the "Software"), to
113 deal in the Software without restriction, including without limitation the
114 rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
115 sell copies of the Software, and to permit persons to whom the Software is
116 furnished to do so, subject to the following conditions:
117
118 The above copyright notice and this permission notice shall be included in
119 all copies or substantial portions of the Software.
120
121 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
122 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
123 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
124 THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
125 IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
126 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Something went wrong with that request. Please try again.