views:

72

answers:

2

I imagine a very common scenario is where an entire dynamic page can be cached in such a way that an entire framework/CMS stack can be bypassed, except that some small amounts of information change depending on whether somebody is logged in or not. For example, the menu might change from "login" to "Welcome Somebody!". No there's not way to cache the page obviously. One solution I was thinking of would be load this information via AJAX after the page has loaded already. Does anybody have an advice here?

A: 

Since this appears to be language-agnostic, you could create a temp file with the raw output of the page, and then when the same page is loaded again, dump the contents of the temp file directly into the HTTP response of the current page.

John Rasch
What would do with the information that changes when somebody is logged in?
blockhead
If the context is on a per-user basis, you could save a link to the page in that user's session.
John Rasch
+1  A: 

Write the page stream to the file system. Name the file with the entire URL including the query string. If the page contains session data, include a session id in the file name. Keep a list of cached pages with their names somewhere so that you can look up whether something is in the cache without having to go to the file system.

This is essentially what FatWire Content Server does.

cdonner