Skip to content


Subversion checkout URL

You can clone with
Download ZIP


Adding documentation to cache_key and adding Gemfile for development #30

merged 1 commit into from

2 participants



Please accept this pull request. It's just adding documentation to the cache_key stuff and also adding a Gemfile for development on this gem.



Looks great. Thanks.

I'll rebuild the site docs and push out an update with your cache key docs soonish.

@rtomayko rtomayko merged commit 5fbea05 into rtomayko:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 23 additions and 1 deletion.
  1. +7 −0 Gemfile
  2. +16 −1 doc/configuration.markdown
7 Gemfile
@@ -0,0 +1,7 @@
+source :rubygems
+gem 'bacon'
+gem 'memcached'
+gem 'dalli'
+gem 'rack', '>= 0.4'
+gem 'rdiscount'
17 doc/configuration.markdown
@@ -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](
Something went wrong with that request. Please try again.