In this tutorial we will explain how to configure your Joomla! CMS application to use Memcached.
Joomla! natively supports Memcached.
This means that you just need to enable this option. In order to do this you have to edit the Joomla! PHP configuration file - configuration.php.
This file is stored inside the web root folder. For example, if your website is accessible at:
http://yourdomainname.com/joomla this means that the configuration.php file is in your public_html/joomla folder.
You can use the cPanel File Manager to edit the file.
For Joomla 2.5, you have to open the file configuration.php and find the following variables:
public $caching = '0';
public $cache_handler = 'file';
Edit them and change the code to:
public $caching = '2';
public $cache_handler = 'memcache';
public $memcache_server_host = 'localhost';
public $memcache_server_port = '11211';
After that save the file.
For Joomla 1.5, you have to open the file configuration.php and find the following variables:
var $caching = '0';
var $cache_handler = 'file';
Edit them and change the code to:
var $caching = '2';
var $cache_handler = 'memcache';
var $memcache_settings = array('compression' => 0, 'persistent' => 0, 'servers' => array(array('host' => '127.0.0.1', 'port' => 11211)));
After that save the file.
That's it - your Joomla! CMS is now correctly configured and it uses Memcached to cache API calls, database calls and objects.