Memcached Backend

Memcached is a distributed memory object caching system. WordPress 2.0 can make use of memcached by dropping in a special backend for the WP object cache. The memcached backend replaces the default backend and directs all cache requests to one or more memcached daemons. You must have a memcached daemon running somewhere for this to work. Unless you’re managing the server on which your blog is running, you probably can’t run a memcached daemon, making this backend useless to you. The memcached backend is targeted at ISPs and those running WPMU. If you are using WPMU and distributing DB requests across multiple servers, memcached will come in very handy. Using memcached for a single blog isn’t really worth it. In my tests, it was sometimes slower than using the default object cache backend.

To install, copy object-cache.php and memcached-client.php to your wp-content/ directory.

To configure, define $memcached_servers in wp-config.php. This is an array of host and ports to which to connect. By default, the backend attempts to connect to port 11211 on the localhost.

Example server config:

$memcached_servers = array('192.168.1.1:11211', '192.168.1.2:11211');

2 thoughts on “Memcached Backend

  1. Ryan,

    How well do you find this works? I remember the conversation coming up on one of the mailing lists but I can’t recall if it ended up panning out as a valuable option. I’m thinking this might work well for our environment (3 servers, faux-load balanced, and a separate database server, 125+ WP-powered blogs).

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s