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.