Archive

Archive for April 12th, 2009

Note on page caching

April 12th, 2009 mahesh No comments

It turns out I can’t use page caching like the way I did in the previous post. The way page caching works is that rails just saves the rendered html in the public directory and next time when the request comes in, if the page exists, it just fetches it. The problem is, if a user is logged in, his name shows up on the top right corner of the page. Now let’s say on the first hit for user foo, rails caches the page. When someone else accesses the same url, rails happily fetches the cached page (with user name foo) to user bar. yikes! User bar is all confused now. Not good.

Moral of the story: Page caching should be used for pages which don’t have any customized information.

What I really need is action caching. Back to the drawing board! I will blog about it when I am done.

See you later,
Mahesh Murthy

Categories: Uncategorized Tags: