Using Rack::Cache to serve static versions of dynamic pages (ala rails page caching)

113 views
Skip to first unread message

Mike

unread,
Jun 7, 2012, 4:25:19 PM6/7/12
to rack-cache
Im using ruby 1.9.2, rails 3.1.3 on Heroku Cedar.

I want to use Rails page caching and Im looking for a technology that
will look for the cached version of a page and serve it directly if it
exists (in the cache) or otherwise forward to the rails component.

To do this I need a way to tell rack::cache to map the incoming URL
with the content. And a way to expire the mapping. Will rack::cache do
this?

So, I read about rack::cache and it seems to work for static assets.
It doesnt explain whats going on under the covers and how to make it
work for anything except static assets. As well, the articles on using
it with static assets seem to all be about cache-control timestamps in
the http response header.

Questions:

1) can I serve static pages generated by the rails page caching
mechanism? If so, how do I tell rack cache that here is some data (the
page html) and here is the "key" for it (and how to say that an
incoming URL maps to that key)?

2) How do I cache clear?

Mike


Reply all
Reply to author
Forward
0 new messages