The_Hat - 7:11 pm on Aug 18, 2010 (gmt 0)
I built a dynamic website that shows dynamic lists based off of different criteria asked of the database. In order to use as few server resources as possible I cache each page above root and based on the age of that cache I either re-query the database or serve the cached file. I use the output buffer for this, starting it at the beginning of each page and writing the contents to the cache at the end.
Now I am wanting to use $_COOKIE to create a "recently viewed" list so that the user can easily go back to an item they viewed previously. But it occurred to me that if I check for a cookie and write the list onto the page that might be also written to the cached file and cause problems.. Is that the case? Would it be included in the output buffer?
I was thinking perhaps that maybe what I should do is use the page that would display the actual recent item list in an iframe on the page.. that way it wouldn't be included in the cache file, except for the fact that I would generate two different cached versions of each page. one with the iframe in the rendered page and one without.
Is there a better way to go about this?