So I’ve been giving a new talk lately, titled Page Caching Resurrected. I brought it out for the first time at Developer Day in Durham, and just last night gave it again at CVREG in Richmond, VA (I was also supposed to give it at Locos por Rails, but ran into a buzzsaw of weather-related delays and cancellations).
Page caching is the most efficient of the markup caching methods that Rails provides, but it suffers from two major problems. First, page cached content is saved to the filesystem, where it is then publicly accessible - regardless of the protections originally placed around that content. Second, page caching is appropriate only for content that is relatively static - things that change quickly, or are relevant to particular users.
The talk I’ve been presenting introduces a technique for bypassing these problems. At the moment, I’m calling it “progressive caching,” though I’m open to alternative suggestions. Basically, the idea is that many pages in an application are mostly cacheable, with only a few distinct regions that change frequently or depend on the identity of the logged-in user. On my comic book site, for instance, the release list has only a few pieces of content that depend on the user:

Progressive caching this content would involve page caching the release list, and then firing off an AJAX request on the page load that, if a user is logged in, returns the appropriate data to fill in those chunks with client-side JavaScript.
This technique grows more powerful when it is paired with Rails Metal, which allows you to bypass some of the overhead of the Rails stack for specific requests. The sample app that I discuss in the talk, for instance, shows the following results:

If you can’t read the numbers, that’s 617ms for a page running on my local machine, pulling back 150 or so covers and adding a tag to 45 of them based on the logged in user vs. 135ms for the same content with progressive caching. In fact, I was able to get the latter version down to 66ms, with some further optimizations.
All in all, progressive caching is a strategy that I think deserves a close look. I’ve worked on a number of applications that could benefit from it, and I imagine others have, as well.
Note: I’ve written a more in-depth exploration of the technique (with actual code!) on Viget Labs’ Extend blog.