93K Views

Configure Magento 1.9.x with Redis as Backend Cache

Magento supports many backend cache with the help of the Zend framework. Memcache and APC are commonly used. However, Redis is rapidly becoming a popular and powerful cache system for Magento and other web applications.

Redis is an open source, BSD licensed, advanced key-value store that can optionally be used in Magento for back end and session storage. It can be used to cache the database resulting in exploitation of less database resources, and provides a tunable persistent cache. It is a good alternative to memcacheD.

When first time page is loaded, a database is queried on the server. Redis caches the query. Next time other user loads the page the results are provided from the redis without quering the actual database. It implements a persistent object cache (no expiration). An object cache works by caching the SQL queries in memory which are needed to load the web page. When the data of main database server is updated,then corresponding key in the redis is invalidated. So the it provides the updated data instead of caching the data. If a query is not available in redis, the database provides the result and it adds the result to its cache.

So, let’s begin with its installing and configure it for Magento.

Update and install redis-server.

Configure Magento,

To enable the module, edit

To

Then, edit the ‘local.xml’ file located in magento directory.

Change

To

Clear all the cache and sessions:

Or, log in to the Admin panel as an administrator,

System > Cache Management,

and, click on ‘Flush Magento Cache’.

Now, restart as,

To check if Redis-server is working or not, Enter

If result is,

Then your server is responding.

Also you can monitor all the traffic  by,

then refresh the page. If you can see logs generating on your terminal, having random alphanumeric characters, then it means caching is working.

You can also check if Redis-server is able to set keys or not,

You can also use ‘info’ command to get information and statistics about the server as,

IN CASE OF ANY QUERY, CONTACT US

Category(s) magento Redis
. . .

Comments (5)

Add Your Comment

  • Ndianabasi
    Thank you so much for this guide and the local.xml config. I have successfully configured Redis for http://www.furnish.ng.
  • Alex
    Thanks for sharing this article, i was looking for help in it, but i had been doing this in live website but i check notice on this post that we need to work on this in staging site, https://www.cloudways.com/blog/how-to-configure-redis-magento-backend/, in this article i found alert and now i am working on staging with the help of your post.
  • PARDEEP KUMAR
    1. Can we clone the above local.xml or need to make some changes in redis setting?
    2. Can we enable redis and opcache both at same time for backend cache?
  • Adi
    Hi, tried this it worked, however if I want to stop using redis I couldn’t get back to normal state of magento. I get always “Connection to Redis failed after 2 failures.Last Error : (61) Connection refused”

    I cleared caches, sessions, flushed redis server, and disabled module Cm_RedisSession.xml. But still can not make magento store working

  • Sameer Bhayani
    Thank you for guide.

    Is this possible to clear cache for specific product only? For example, I have thousands of product and If I update product which is having id 5,at that time I need to clear cache of product which is having id 5 only.

    Is this possible?

    Thank You.

  • css.php