WordPress Memcached Turbo Boost and Check Hits and Misses

Memcached is a general-purpose distributed memory caching system. It is often used to speed up dynamic database-driven websites by caching data and objects in RAM to reduce the number of times an external data source (such as a database or API) must be read.

Implement

  • Installation

For OS X

Install Memcached for PHP on OS X

For Ubuntu and Debian

$ sudo apt-get install memcached

For CentOS

$ sudo yum install memcached
  • Start the Memcached daemon
$ sudo service memcached restart

Verify that Memcached is installed and running.

From your server, telnet into the Memcached server

$ telnet localhost 11211

You should see output like:

Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.

Type version into the Telnet prompt. If Memcached is installed and running, you should see something like:

VERSION 1.4.24

Flush Memcache by typing flush_all, exit Telnet by typing Ctrl ], hit Enter, then typing quit and press Enter.

Install the Memcached PECL extension on your server. Note that there are two different PHP interfaces for Memcached; one is named PECL Memcache and the other, PECL Memcached. The "d" at the end of Memcached is extremely important in this case. You should be able to install PECL Memcached from your package manager for your Linux distro.

For OS X

Install Memcached for PHP on OS X

For Ubuntu and Debian

$ sudo apt-get install php5-memcached

For CentOS

$ sudo yum install php-pecl-memcached

Note that if you have a more custom installation of PHP, you might need to take some extra steps to link the PECL Memcached extension to PHP. If you are setting this up using your package manager's version of PHP and PECL Memcached, this should not be necessary. For example, many yum.conf files will exclude packages that begin with php. You may be able to modify the configuration file as necessary to install this package.

Download Memcached Object Cache plugin, copy object-cache.php to wp-content.

Check memcached server cache hits and misses

Download pecl-caching-memcache and copy memcached.php in hosts path, edit params in file

define('ADMIN_USERNAME','memcache');    // Admin Username
define('ADMIN_PASSWORD','password');    // Admin Password

Visit memcached.php via browser, will see like this

WordPress Memcached Turbo Boost and Check Hits and Misses

WordPress Memcached Turbo Boost and Check Hits and Misses
19 votes, 4.34 avg. rating (87% score)