My best post on Rails page caching

I was going to write a great post about Rails page caching, but then I found Gregg’s post about page caching

There are two points I’d like to make to add to the Rails page cache knowledge base.

Firstly, if you use paging in your cached actions, then you must use the FileUtils method for sweeping these pages (unless you want to write code that checks for every possible page number and expires that page with expire_page, and you really don’t)

Secondly(?), if you are going to use the FileUtils to remove files from the cache, you don’t need to move the cache location. You only need to move the cache location if you want to delete the entire cache in a single call.

For example, I have code that deletes a paged action, and the cache files are in /public/controller/action/page-number.html and /public/controller/action.html, so FileUtils.rm_rf ”/public/controller/action works for me without changing the cache path.

This entry was posted on Wed, 14 Mar 2007 03:10:31 GMT . You can follow any any response to this entry through the Atom feed. You can leave a comment or a trackback from your own site.
Tags


Trackbacks

Use the following link to trackback from your own site:
http://blog.craz8.com/trackbacks?article_id=my-best-post-on-rails-page-caching&day=13&month=03&year=2007

Comments

Leave a response

  1. Chris about 19 hours later:

    Nice addition to Gregg’s post. I especially like how you’re partitioning off the cache files. It makes it super easy to remove cached-paginated files. Thanks!

  2. Alex about 1 month later:

    Thank You

Leave a comment