Speed, performance, stability, and superior support—these are the four ingredients of any best web hosting company that are crucial in providing high performing server setups to our satisfied customers. We are always on the lookout for next-gen technologies that enhance the performance of our managed servers.
This tutorial is about Redis cache that is now universally available on Cloudways servers. Redis is a data structure server that can be used as a distinct web server. In other implementation scenarios, its caching mechanism can be combined with MySQL or MariaDB to speed up WordPress database queries. However, enabling Redis on Cloudways servers requires a bit of work and in this tutorial, I am going to show you the correct procedure for adding the Redis cache support for WordPress.
Like every other procedure that directly affect the live WordPress website and underlying servers, you need to take several precautions when adding Redis cache support:
- Either backup your WordPress app or clone it to a new server.
- To avoid conflict between application data of multiple websites on a single server, you need to be extra careful when adding Redis on all of them. Make sure that you are working on the correct website when adding Redis.
- It is better to first test this method on a test website. Once you are confident that everything configured correctly, proceed to the live website.
Activating Redis cache
The first step is the activation of Redis on Cloudways server.
To do this, login to your Cloudways account and navigate to Servers > Settings & Packages > Packages and then install Redis. This will install the latest Redis version on your server.
On the Cloudways server, I will use the Redis caching feature to further optimize the WordPress object cache. By default, WordPress has a built-in caching rule that caches database queries on single page loads . To use this caching persistently across other page loads, I need to use a “drop-in” object-cache.php generated by Redis Object Cache plugin.
W3TC also added support for Redis in their 0.9.5 update and the method of adding Redis is very straightforward. On Cloudways, you can configure Redis cache using the preinstalled W3TC plugin. However, if you are not using W3TC, I recommend using the Redis Object Cache Plugin.
In this tutorial, I will cover two different methods of configuring Redis cache on WordPress.
Method 1: Use W3TC to Configure Redis Cache
As stated earlier, configuring Redis via W3TC is very easy. Just login to your WordPress Admin and navigate to Performance > General Settings > Object Cache. From the drop-down menu, select Redis and make sure that the option is enabled.
Test Whether Redis Is Working on the WordPress Website
You can easily test whether Redis is working either through W3TC or the SSH terminal.
To test via W3TC, navigate to Performance > Object Cache. Click the Test button. If you see a Test passed message, the Redis cache is working fine. If you are not sure about how Redis works, we suggest to keep the settings on default.
Method 2: Use the Redis Object Cache Plugin
If you are not using W3TC plugin or Object Cache in W3TC, then I recommend the Redis Object Cache plugin. The process of setting up this plugin is slightly more complicated. It is also recommended to keep Object Cache option in W3TC disabled.
Step 1: Turn off Object Cache in W3TC
In the first step, turn off the object cache rule in W3TC as it does not support Redis. For this, navigate to Admin > Performance > General Settings. Then, scroll to the Object Cache option, uncheck it, and empty the cache.
Step 2: Install Redis Object Cache plugin
Next, we need to install the Redis Object Cache plugin. It installs a PHP script that helps WordPress communicate with Redis. After installing the plugin you need to activate it. Navigate to Settings>Redis and click on “Enable Object Cache” and make sure status shows “Connected”.
Visit Us Daily For More Such Online Scripts & Loot Deals + Tricks?