wp-cache – a reminder to myself

June 20th, 2007

wp-cache is a useful plugin for speeding up your WordPress blog. However, it has some disadvantages:

  1. If you're in the middle of a redesign, where you're changing the presentation features of the site without changing the content, you have to clear the cache to see the effects of changes.

    To clear the cache, go to the wp-content/cache directory and do:
    rm -rf *
  2. If, like me, you have some fairly static pages that contain dynamic content in a sidebar (e.g. an About page that has a list of recent posts in the sidebar), the sidebar content will not change because wp-cache makes sure the page from the cache gets served up unless something actually changes in the content.

    Effectively this means doing a manual cache clear every time you post if you want your static pages to be regenerated.

Turning off wp-cache

WordPress leads you to believe you can turn off wp-cache by deactivating it in the Plugin Management page of the admin interface. Unfortunately it's not as easy as that.

What you need to do is go into your wp-config.php file and delete or comment out (by adding // at the start of the line) the following line:

define('WP_CACHE', true)

If you want to completely remove wp-cache, rather than just temporarily disabling it while you do some redesign work:

  1. Delete the wp-cache directory within the wp-content/plugins directory.
  2. Delete the line from the wp-config.php file, as above.
  3. Delete the wp-cache-config.php and advanced-cache.php files from the wp-content directory.

Where wp-cache comes into its own is if you have a standard blog that gets a lot of hits. wp-cache stores ready-made HTML pages that can be served straight up to your visitors without having to use PHP to generate SQL queries to the MySQL database and build HTML dynamically.

This website uses IntenseDebate comments, but they are not currently loaded because either your browser doesn't support JavaScript, or they didn't load fast enough.

Leave a comment