This website uses cookies

Our website, platform and/or any sub domains use cookies to understand how you use our services, and to improve both your experience and our marketing relevance.

CloudwaysCDN — a powerful solution that offers superior performance and satisfied global audience for your business. Read More

How to Configure Redis Cache on WordPress

Updated on  May 11, 2018

5 Min Read
Reading Time: 5 minutes

Speed, performance, stability, and superior support—these are the four ingredients of Cloudways 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.

Activate Redis Cache on WordPress wesite

This tutorial is about WordPress 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:

  1. Either backup your WordPress app or clone it to a new server.
  2. 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.
  3. 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.

Install Redis Cache

The first step is the activation of WordPress 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 Redis on your server.

Install Redis on Cloudways 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 [read more]. 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 any third party Redis supported plugin. In our guide, I will be using W3TC. 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.

redis cache in w3tc

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 keeping the settings on default.

You can also test Redis via the SSH terminal. To access SSH terminal on Cloudways, navigate to Servers > Select Server > Master Credentials and click the Launch SSH Terminal button. Login to the SSH with the Master Credentials. Run the Lcommand below.

If everything is properly configured, you should get the message OK. Next, visit your website or navigate through pages of the website and you should receive output similar to the following:

check redis is working

To stop the monitoring, hit Ctrl+C on your keyboard.

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. 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”. If not, then make sure you have enabled Redis in the Cloudways platform as discussed above.

redis object cache enable

Step 3: Edit the wp-config.php file

At this point, you must take a backup of the wp-config.php before proceeding.

In the wp-config.php, I will add a cache key salt using the define (‘WP_CACHE_KEY_SALT’, ‘’); under * Authentication Unique Keys and Salts.

You can use any unique string in your URL, but for Cloudways, I recommend that you use the URL of your website. It is especially helpful if you are hosting multiple websites on a single Cloudways server. You can read more about it here.

To make the cache persistent across all page loads, we need to add define (‘WP_CACHE’, true);

The final wp-config.php file will resemble something like this:

 Step 4: Monitoring and Verifying Redis Cache Working

You can check via the command redis-cli monitor in the SSH terminal or you can check via the Redis Object Cache plugin settings. To check if Redis is connected you can navigate to Admin > Settings > Redis. You will see something like this:

Wp Redis Connected


Cloudways has come a long way. Our commitment to quality, speed, performance, and customer support has made us gather a loyal community of followers. And, like any other customer-focused company, we value the feedback of our customers. Redis Cache is an outcome of the feedback we received from some of our customers. We already had Varnish and Memcache in our arsenal, a basic WordPress site hosted on Cloudways and Breeze installed can be loaded in just 143 ms, and now with the addition of WordPress Redis, it can be loaded at the blink of an eye.

This tutorial details the process of adding Redis cache to WordPress websites hosted on Cloudways managed cloud servers. If you wish to clarify a specific point or would like to contribute to the discussion, please leave a comment below. 

Share your opinion in the comment section. COMMENT NOW

Make Your WordPress Website 100% Faster.

Host it now on Cloudways WordPress Hosting Platform.

About The Author

Ahsan Parwez

Ahsan is the Community Team Manager at Cloudways – A Managed Cloud Hosting Platform. He loves to solve problems and help Cloudways’ clients in any aspect he can. In his free time, you can find him playing RTS PC games.

Stay Connected:

Get Our Newsletter
Be the first to get the latest updates and tutorials.


  • 77777_net

    Since 4.3 i have to delete object-cache.php otherwise i can’t login in wp_admin.. is this a known error? even if deactivating the redis object cache plugin – the object-cache.php causes the error..

    • The method and plugin are working fine with 4.3. Make sure you disable “Object Cache” in the W3TC General Settings tab. That will remove the W3TC object-cache.php file, then install the Redis Object Cache plugin and enable it.

      Sometimes the older object-cache.php files remain in the wp-content folder, you will need to manually remove it through SFTP and follow along the tutorial.

  • There is actually a redis-plugin

    You mention varnish, I suggest you implement hash_always_miss for always serving updated content without having to purge

    • Hi Mike,

      We are using the same Redis plugin on Cloudways.

      As for Varnish we have similar rules and there are few scenarios where we have to purge Varnish manually.

  • Great guide Ahsan! I have made a Swedish translation of the guide and they who will read it in Swedish can do it here.

    • Thanks Stefan for translating. Love the fact that you like being on Cloudways, stay tuned for more features 🙂

  • Splendor

    Does anyone if redis cache works good with buddypress?

    • It should work just as fine because we are using it as object cache.

  • Joe Joeseph

    Can you provide more info about what needs to be done when you say:

    “To avoid conflict between application data when having multiple websites on a single server, you need to be extra careful when adding Redis on all of them.”

    This is the case for me. I have a single server with several wordpress installs (each in their own directory).
    I am guessing there is a setting somewhere where each website interacts with redis using a unique name so that the results it gets back are for it and not for what would otherwise be an identically named object on one of the other websites.

    • Hi Joe,

      In this method you had to edit the wp-config.php and move the object-cache.php file to correct folder, what I meant by that is that you have to be careful that you are working on the correct file and website while adding Redis on any one of them.

  • Joe Joeseph

    I notice W3 Total Cache shows Redis as a choice when you go to the General Settings and look at the Object Cache section. Is this workable or do you still recommend leaving it off there and installing the redis cache plugin as descrined in this article?

    • Hi Joe,

      The Redis support in W3TC was added in the 0.9.5 version and it is working just as well. To use it make sure Redis is installed on your server and under “Object Cache” select Redis.

      To test it navigate to Performance -> Object Cache and hit “Test” or you can check if Redis is working via SSH terminal by typing in the command “redis-cli monitor” and visiting the website.