How to Configure Redis for WordPress

How to configure Redis for WordPress

If you’re looking for the fastest caching option for your WordPress site, then look no further than Redis. REDIS – which is an acronym for REmote Dictionary Server – is an open-source, key-value store. If you’re not into the technology, then we understand that this will sound like mystery techno-ese. To put it in layman’s terms, it’s very fast! Redis works within RAM instead of accessing your hard drive. This is one of the major reasons that Redis improves WordPress performance. Redis is provided on your VPS or Dedicated Server, but if you require installation steps please see How to Install Redis on your VPS or Dedicated Server.

This article will be focusing on setting up the Redis Object Cache plugin that is easily installed within your WordPress site. Follow the steps below to learn how to install and then use the Redis Object Cache plugin to improve the performance of your WordPress site.

Installing Redis Object Cache Plugin

  1. Login to your WordPress Administrator Dashboard
  2. Click on Plugins.
  3. Click on Add new.
  4. In the search field, type in “Redis.” This will search for the Redis plugins that are available. You will see multiple plugins, but the plugin that we are focusing on today is Redis Object Cache.
  5. Click on the Install Now button for Redis Object Cache.
  6. When the installation completes, click on Activate.

This completes the installation for Redis Object Cache plugin for WordPress. The plugin only has a few options making it very easy to implement as long as your VPS/Dedicated server has Redis properly running. Follow the steps below to enable the Redis Object Cache plugin.

Enabling the Redis Object Cache

Click on Enable Object Cache to turn on the cache.

When you first look at the Redis Object Cache settings, it will bring you to the page that you see above. Notice that the cache status is set to Disabled.

  • Click on Plugins and you will see the list of plugins that you have installed and activated.
  • Find Redis Object Cache and then click on Settings. You can also go to Settings in your WordPress menu and click on Redis.
  • Click on Enable Object Cache to turn on the cache. It will connect to the server using the default port of 6379. If you are unsure of how to open the port, then contact our live technical support team for assistance. If you have root access, then you can also reference this article: How to Open a Port in your Firewall.
  • Click on Show Diagnostics and you can see if the plugin connected. The screenshot below shows the plugin running.
Click on Show Diagnostics and you can see if the plugin connected.

Configuration Parameters for Redis

There are many settings that can be manually set for the Redis Object Cache plugin. Here are a few of the settings listed on the page:

WP_CACHE_KEY_SALT (default: not set) – Use this parameter to ensure that each cache key is unique. You would use this parameter when you have multiple WordPress installations using the same wp-config.php file.

WP_REDIS_SELECTIVE_FLUSH (default: not set) – Use this option if you want to only flush specifically prefixed caches (using the WP_CACHE_KEY_SALT). If you are not using this setting then the full Redis database would be flushed.

WP_REDIS_MAXTTL (default: not set) – You can set the maximum “time to live” for cache keys that have their expiration time set to 0.

WP_REDIS_GRACEFUL (default: not set) – When this parameter is set to false, then friendly (graceful) failures are disabled allowing you to see errors/exceptions.

In general, you may see performance gains by using the default settings, but there are several more that you can use if needed for your specific WordPress Installation. Redis Object Cache offers a premium version of the plugin with more advanced options for users, including data compression and site health checks.

AC
Arnel Custodio Content Writer I

More Articles by Arnel

2 thoughts on “How to Configure Redis for WordPress

  1. After using Redis for a while, I got 500 Error, so I tried to disable the Redis Plugin and the Website work well again. How can I fix that and make Redis work again in my Website.

    1. Hello and thanks for asking. I recommend you contact Live Support as we don’t have enough info to troubleshoot that here.

Was this article helpful? Join the conversation!