Magento has built in support of memcached ,you only need to enabled it by making some changes in the configuration file.
Memcached is a high-performance memory object caching system that is designed to speed page loads on dynamic content websites. Magento supports Memcached for caching many objects, but it is not enabled by default and will require some simple changes to your configured local.xml file to use.
First, be sure that Memcached is installed and running on your server. It by default listens on port 11211. A ‘netstat’ will verify that you do indeed have a Memcached listening socket on port 11211 indicating that is it running. Configuring Memcached to listen on localhost is recommended as it would be a security risk allowing any external sources access Memcached directly if it were to be listening on an external ip that wasn’t firewalled.
You also need to be sure that Memcached support is loaded into PHP. A view on a phpinfo() page can verify this, just look for the ‘Memcache’ block in the phpinfo and be sure it is ‘enabled’.
To enable Memcached within Magento, you will need to add the following block of code to your app/etc/local.xml file:
<cache>
<backend>memcached</backend><!-- apc / memcached / empty=file -->
<memcached><!-- memcached cache backend related config -->
<servers><!-- any number of server nodes can be included -->
<server>
<host><![CDATA[127.0.0.1]]></host>
<port><![CDATA[11211]]></port>
<persistent><![CDATA[1]]></persistent>
</server>
</servers>
<compression><![CDATA[0]]></compression>
<cache_dir><![CDATA[]]></cache_dir>
<hashed_directory_level><![CDATA[]]></hashed_directory_level>
<hashed_directory_umask><![CDATA[]]></hashed_directory_umask>
<file_name_prefix><![CDATA[]]></file_name_prefix>
</memcached>
</cache>
Once the code is added, save the local.xml file and check your site. No process restarts are needed, as soon as the code is saved it goes into effect allowing Magento items to be cached in Memcached. If after saving your site fails to load, go back and check your local.xml configuration and servers Memcached config.
Hope you like this.
0 comments:
Post a Comment