cache_page - phpWebSite page level cache module
cache_page uses php output buffering to capture the output of phpWebSite and store it in a cache in the files/cache_page/cache directory. Pages are identified based on the request_uri. The next time the same request_uri is received, the stored page will be served from the cache instead of being dynamically generated by phpwebsite.
See a working installation of cache_page at the City of Rolfe website. Use ‘view source’ to see the page generation times appended to the end of each web page.
The speed increase received by using cache_page varies based on the modules being used. Pagemaster pages were served an average of 4 times faster on my development server. The full year calender view was a considerably larger speed increase.
The cache is completely cleared each time a POST or PUT http method is received by the server. This should catch most of the instances where the cache needs to be cleared. It also clears the cache at unnecessary times like when someone logs on or when someone uses the search box.
Pages served to logged on users are always dynamically generated and never saved to cache.
To allow for the calendar module, the cache is completely cleared whenever a page is retrieved from the cache that wasn’t generated on todays date. In effect, the cache is cleared at midnight.
I have tested cache_page on phpwebsite versions 0.10.1 and 0.9.3-4. The announcements and pagemaster modules appear to work fine. The calendar module works fine after a few simple modifications. (see INSTALL.txt)
Modules that generate unique session output are not compatible with cache_page. That means that the ‘You have x items in your cart’ box of the kcart module is not compatible. In many cases it should be simple to remove the unique session output, such as converting the ‘x items in your cart’ to a simple ‘View Cart’ button.
11/9/05
Updated release available Cache Page phpWebSite module 0.0.3
October 27th, 2005 at 12:45 pm
I tried your script. I like the concept, but tried it on phpWS 0.10.2 - everything went well until I tried to change the calendar file settings. I got error messages about a missing file. I had used the 0.10.1 patch file. I’m sorry, I did this a few days ago and reverted everything so I don’t have the messages handy.
I’m really just writing to inquire whether you know of any issues with 0.10.2.
Thanks,
Guy
November 9th, 2005 at 3:37 pm
Guy-
Thanks for your help testing Cache Page with phpWebSite 0.10.2!
November 30th, 2005 at 7:03 am
Sorry for my english.
I tried your script with phpWS 0.10.2 on apache and everything went well. But on IIS pages are cahed but not refreshed. I just can se only the first page.
Try my website on http://braga.cne-escutismo.pt/site
Can you help me.
Thanks,
SRI
February 27th, 2006 at 2:09 pm
Brilliant! had just posted in the phpwebsite forum about a flat cache when after a bit of searching I found your module.
Thank you !
:)
July 16th, 2006 at 3:45 pm
Hi
i tried to run pagecache… but it wont cache. all time same status:
wasn’t logged in, an no GETs or POSTs were sent
the dir files/cache_page/cache is empty all the time (world writeable!)
any idea??
thanks,
Marc
July 16th, 2006 at 3:48 pm
sorry… i couldn’t post the state…
have a look at http://www.marcrisse.de
July 17th, 2006 at 5:54 am
Marc -
There is something funky going on with your php sessions. phpwebsite uses an md5 hash for the session_name and the session_name for your site is PHPSESSIONID.
I’m guessing you installed something that has modified the session behavior and is interfering with Cache_Page
If I delete the cookies for your site and then reload the page, it is always served from the cache.
Before that I’m guessing it’s not serving the page from cache because it thinks I’m logged in.