2009
08.23

WordPress can work with memcached as a cache, and there are plenty of places to find instructions on how to do that.

I referred to Ryan‘s and Mohanjith‘s blog posts that detail this, and after some tweaks to get it up working with the most recent version of WordPress on PHP5, I’ve decided to write some instructions that are a little more recent ;)

1. Install WordPress and memcached. (duh)

Google for instructions on how to do that for your relevant distros, but I won’t be covering that here.  I assume that your memcached server is listening on 127.0.0.1:11211.

2. Copy object-cache.php into wp-content folder.

I’ve mirrored Mohanjith’s modified version here.  Do remember to rename it to object-cache.php, and make it readable by the PHP user account.

3. Edit your wp-config.php file.

Add these lines in:

global $memcached_servers;
$memcached_servers = array('default' => array('127.0.0.1:11211'));
global $blog_id;
$blog_id = 'some_unique_identifier';

If you have different WordPress blogs using the same memcached cache, $blog_id MUST be unique across different blogs.  Else you can just leave it as it is ;)

4. Enjoy the speedup.

There you’re done!  You can verify that WordPress is using the memcached cache by issuing the “stats” command to memcached, which I probably will write how to in another post.

Share and Enjoy:
  • Print
  • Twitter
  • Digg
  • del.icio.us
  • Facebook
  • DZone
  • LinkedIn
  • Ping.fm
  • Posterous
  • Slashdot
  • StumbleUpon

Related posts that you might be interested in...

No Comment.

Add Your Comment

Anti-Spam Protection by WP-SpamFree