Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding documentation to cache_key and adding Gemfile for development #30

Merged
merged 1 commit into from May 25, 2011
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 7 additions & 0 deletions Gemfile
@@ -0,0 +1,7 @@
source :rubygems

gem 'bacon'
gem 'memcached'
gem 'dalli'
gem 'rack', '>= 0.4'
gem 'rdiscount'
17 changes: 16 additions & 1 deletion doc/configuration.markdown
Expand Up @@ -109,4 +109,19 @@ a refresh (e.g., clicking the "Refresh" button).

### `cache_key`

TODO: Document custom cache keys
A custom cache key generator, which can be anything that responds to :call.
By default, this is the `Rack::Cache::Key` class, but you can implement your own
generator. A cache key generator gets passed a `Rack::Request` object and generates
the appropriate cache key.

The `Rack::Cache::Key` class by default returns the fully qualified url of the request.

In addition to setting the generator to an object, you can just pass a block instead,
which will act as the cache key generator:

set :cache_key do |request|
request.fullpath.replace(/\//, '-')
end

For more options see the [Rack::Request documentation](http://rack.rubyforge.org/doc/classes/Rack/Request.html)