How to configure WordPress to use Redis

This article describes how to configure WordPress to use Redis.

Redis is an open-source memory object caching system that web sites can use to help accelerate page load times. Redis works by caching in RAM frequently accessed data, such as the results of API calls, database queries, and more. It is frequently used as an alternative to memcached, another caching system.

By adding Redis caching to WordPress, you can help improve your site's performance and page load times.

  • Redis is currently enabled on Managed VPS and Managed Dedicated server accounts.
  • If you have an unmanaged VPS or unmanaged Dedicated Server, you have full root access and can install and configure Redis yourself.
  • Redis is not supported on shared hosting accounts at this time.

WordPress plugin support for Redis

There are several plugins available for integrating Redis caching with WordPress. This article describes how to do so with two of the most popular Redis plugins, Redis Object Cache and WP Redis.

You can use whichever plugin you prefer (and you should only use one of these plugins at a time, not simultaneously). With Redis Object Cache, you can do all configuration through the WordPress UI. For WP Redis, you use the command line to complete the configuration.

Option #1: Redis Object Cache plugin

The Redis Object Cache plugin enables you to easily set up your WordPress site to use Redis.

To install and configure Redis Object Cache on your WordPress site, follow these steps: 

  1. Log in to WordPress as the administrator.
  2. On the Dashboard in the left sidebar, click Plugins, and then click Add New:

    WordPress sidebar - Plugins - Add New

  3. On the Add Plugins page, in the Search plugins text box, type redis object cache and then press Enter.
  4. Locate the Redis Object Cache section, and then click Install Now:

    WordPress - Redis Object Cache installation

  5. When installation is complete, click Activate. The Redis Object Cache page appears:

    WordPress - Redis Object Cache configuration

  6. Click Enable Object Cache. When you see green checkmarks for Status, Drop-in, and Filesystem, Redis is activated and running for WordPress:

    WordPress - Redis Object Cache - Successful configuration

  7. You do not need to do anything further to take advantage of performance improvements from Redis caching. The following options are available:

    • To view statistics about Redis caching on your site, click the Metrics tab.
    • To view detailed configuration and debugging information, click the Diagnostics tab.
    • To flush the Redis cache, click Flush Cache.
    • To disable Redis caching, click Disable Object Cache.

Option #2: WP Redis plugin

To install and configure WP Redis on your WordPress site, follow these steps: 

  1. Log in to WordPress as the administrator.
  2. On the Dashboard in the left sidebar, click Plugins, and then click Add New:

    WordPress sidebar - Plugins - Add New

  3. On the Add Plugins page, in the Search plugins text box, type wp redis and then press Enter.
  4. Locate the WP Redis section, and then click Install Now:

    WordPress - WP Redis installation

  5. When installation is complete, click Activate.
  6. Log in to your account using SSH.
  7. At the command prompt, change to the directory where you installed WordPress.
  8. To enable the object cache, type the following command:

    wp redis enable
  9. You do not need to do anything further to take advantage of performance improvements from Redis caching. To view status information about the object cache, type the following command:

    wp redis info

    To list all of the keys in the object cache, type the following command:

    redis-cli KEYS '*'

    To clear the entire cache at once, type the following command:

    redis-cli FLUSHALL

More Information

Get WordPress Hosting

Article Details

Other Articles in This Category

Show More

Did you find this article helpful? Then you'll love our support. Experience the A2 Hosting difference today and get a pre-secured, pre-optimized website. Check out our web hosting plans today.

Usamos cookies para personalizar o site para você e para analisar o uso do nosso site. Você demonstra que concorda com isso ao clicar em "Eu concordo" ou ao continuar usando este site. Mais informações sobre cookies podem ser encontradas em nossa Política de privacidade.