Thursday, July 19, 2007

Rails caching

Options :
Page caching
Action caching
Fragment Caching

Read these:
Real World Rails series

Content Caching in Rails

For fragment caching, use timed_fragment_cache which allows the cached content to be expired automatically based on a timeout.

I was thinking of allowing my users to request an explicit rebuild of the page by forcing the cache to expire before the timeout. This could be done by providing an action which will simply expire the fragment and redirect back to the original action.
However in the event that two users click on the rebuild request within say 1 minute of each other, I want the subsequent build request to be ignored automatically. I will take a stab at modifying the timed_fragment_cache plugin for doing this.

No comments: