Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Browse files

Adding documentation for cache_key and adding Gemfile for development

  • Loading branch information...
commit 61da6ec9c77ef8121efe5bdf9c9a94e7beb28137 1 parent 71dd8fb
@hexgnu hexgnu authored
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](
Please sign in to comment.
Something went wrong with that request. Please try again.