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
2009-03-18 15:03:11
What would do with the information that changes when somebody is logged in?
blockhead
2009-03-18 16:32:58
If the context is on a per-user basis, you could save a link to the page in that user's session.
John Rasch
2009-03-18 16:42:10
+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
2009-03-18 15:04:19