Warning! This requires some technical changes in your Magento app. Therefore, we recommend that developers test this method on a staging website first.
If you need an exceptionally versatile data store shared by different procedures, numerous applications, or various servers then configuring Magento, Redis cache is the best decision you will take.
Magento supports many backend caches with the help of the Zend Framework. Memcache and APC are commonly used. However, nowadays Redis is fast becoming a popular and powerful caching system for use with Magento and other web applications. This is why it is important that developers should know how to configure Redis cache on Magento backend.
What is Redis Cache?
Redis cache lets you impart cross-stage, cross-server, or cross-application and makes it an excellent choice for numerous utilization cases. Its speed, likewise, makes it incredible as a cache layer.
Redis has a virtual memory, where once in a while utilized keys would be swapped out to circle so that only the keys needed to fit into the memory are used. Going ahead, the utilization cases for Redis are those where it’s feasible for the whole information set to fit into the memory.
The essential point of interest of utilizing Redis cache is that store labels are upheld. The moderate-level file system cache is no longer needed to be utilized. This Magento cache backend is prescribed in multi-server situations where you have more than one web server.
In this article, I am going to demonstrate how you can connect Magento, Redis cache using Cloudways Managed Magento Hosting Platform.
Enable Redis Using Cloudways Platform
- Sign in with your Cloudways account and click on your Server.
- Server Management console appears and click on Settings and Packages section.
- In Setting and Packages, click on Packages tab.
- Now install the Redis as shown.
5. Click on Manage Services.
6. In Manage Services, start the Redis.
Redis is now enabled on your Cloudways server.
Configure Redis With Magento
In the next step of configuring Magento, Redis cache, you need to edit a couple of files. In Magento 1.9 there is a built-in Redis module, Cm_RedisSession.xml. To activate it, you need to access it through SFTP. You can find SFTP access details in Master Credentials.
Navigate to app/etc/modules/Cm_RedisSession.xml and open it in a text editor.
Change the value of <active> to true.
Save your changes to Cm_RedisSession.xml and exit the text editor.
Following code configures your Redis cache backend that you can use with your database index to hold a cache of your Magento store. Go to your local.xml file to tweak the code.
Here is the code that you need to copy and replace in your local.xml file. You can see your local.xml file under your magento root directory app/etc/local.xml.
Note: Use this code after <session_save><![CDATA[files]]></session_save>
Once edited, save your local.xml file. Then go to your var folder and delete all files and folders under the var/cache. Magento will rebuild the cache after a few hits on the website.
Check if Redis is Working?
Now check whether Redis Cache is working and connected with your Magento store or not. For this, Go to Server Management.
In Server Management,click Launch SSH Terminal and use these two commands to check whether Redis Cache is working fine or not:
- To check if Redis is working on the server, use this command redis-cli ping. (If you receive your PONG, you can proceed.)
- In order to determine whether Redis configuration on your Magento store has been successful, use the redis-cli monitor command in the SSH Terminal. Each time your website is refreshed, you to view command line information of communication between your site and the Redis cache. To end the monitoring session, press Ctrl+C.
- For verifying PhpRedis, use this command php -m | grep redis. If you receive Redis. As a result, it’s mean your Redis cache is enabled and working fine with your Magento store.
Enabling Redis on your Magento store will make it swifter. Users can deploy applications like Magento, WordPress, Laravel, Joomla, and PHP Stack in one-click on Cloudways. This is why it is essential that magento developers should know how to setup Redis cache in Magento backend.
The optimization formula of Cloudways uses Apache, Nginx and now, Redis. This unique combination significantly improves the performance of your web applications. Sign up now for a free trial of Cloudways Redis Cloud Platform.
Fayyaz is a Magento Community Manager at Cloudways - A Managed Magento Hosting Platform. His objective is to learn & share about PHP & Magento Development in Community. Fayyaz is a food lover and enjoys driving. You can email him at email@example.com
Convert visitors into buyers on your 100% faster Magento store.
Deploy your Magento stores on optimized Magento hosting servers.