This is not a post about WP-Cache The plugin. This is a post about wordpress own internal caching mechanism — WP-Cache functions and WP_Object_Cache class. The function used alot inside wordpress for making extensive function calls. The only shame is that the cache is not persistent between request. So, every request will have to generate its cache again. What I’m attempting to do, is implementing persistent cache that last between request.

The first thing before installing the custom cache script that one should check for existing persistence cache app such as Memcached, XCache or APC. Using one of those app is such a performance boost for PHP application. If you don’t have those installed on your server, you can always ask the admin. And if all other options is failed. We can use the good-ol file cache. I’m using the combat-proven PEAR Cache Lite library for file caching mechanism.

The second, there are no flushing or expiring mechanism, so I have to create a small plugin for flushing the cache. Usually flushing is needed when you delete or add plugin or theme. WordPress won’t recognize your plugin, since the plugin list gets cached.

How to Try

  1. Download the cache manager plugin from the link below:
  2. Upload the object-cache-manager.php into the wp-content/plugins/ directory
  3. Enable your plugin, you’ll need to enable this first before installing the object-cache file.
  4. Download the pear Cache_Lite package from the page.
  5. Extract it, rename the Cache/Lite.php file to Cache_Lite.php
  6. Download the object-cache.php file from link below:
  7. Upload both into the wp-content directory on your server
  8. Create wp-content/pear-cache directory. This directory must be writeable by the webserver. It will store your cached data as file if you decide to use pear cache lite class.
  9. You;re good to go