PEAR Output Cache and WPMU

One of those things PHP doesn’t do well is load large libraries of scripts into memory and parse them quickly. WordPress and Smarty fall firmly into this category and the caching I’ve done so far has only addressed half of this problem: cached pages don’t load any WordPress code, but the heavy Smarty library was still loaded.

I’ve now modified my code to use the PEAR Output Cache and that avoids loading the Smarty templating system. On a heavily loaded server this should make quite a difference to visitors. Things still need tweaking, I may need to introduce a “time” aspect to the cache key as pages could be cached indefinitely but for now it seems to be working really well!
Note to self, please remember that gzip compression upsets PHP’s output buffer. Note to everyone else, don’t set “gzip compression” in the backend or your blog will be foobarred! (Thanks Mel for testing his blog and reporting problems with it!)

Author: Donncha

Donncha Ɠ Caoimh is a software developer at Automattic and WordPress plugin developer. He posts photos at In Photos and can also be found on Google+ and Twitter.

1 thought on “PEAR Output Cache and WPMU”

Leave a Reply