Menu

richardtape.com

A WordPress Guy

Memcached for WordPress on Ubuntu 14.04

If you’re unsure of what an object cache is, or what memcached is, your first port of call should be Scotty’s article on the subject.

WordPress has built-in support for a PHP object cache. However, it only exists temporarily – for a single page load. The best way to explain this is to think about options. When a page loads, WP loads all options from the database (technically all ‘autoloaded’ options, which is the default). Any later request for get_option() will call from the in-built object cache meaning no more hits to the database.

However, if you want this to be more persistent, you need to set up one of several solutions. One is setting up a memcached server. Sounds complicated. It kinda is…but, thanks to people who are much, much smarter than I am, the process of setting up memcached for WordPress is now simple. In order to get this working, you need to do two or three things;

  1. Install memcached on your server
  2. Place a config file in the correct location
  3. (sometimes) Adjust your wp-config.php file

(more…)