July 26, 2019 Read time: 4:17
In this Article:
- How to install Redis Object Cache for WordPress
- Enabling Redis Object Cache
- Configuration Parameters for Redis Object Cache
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
- Login to your WordPress Administrator Dashboard
- Click on Plugins.
- Click on Add new.
- 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.
- Click on the Install Now button for Redis Object Cache.
- 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
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.
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:
Note: All of these configuration settings would be added to the wp-config.php file in your WordPress installation.
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 settings that you can use if needed for your specific WordPress installation. These settings include connection parameters and options for replication & clustering. To see a comprehensive list, please go to the Redis Object Cache plugin page on the WordPress webpage. You will see the list of settings on the Details tab of the plugin.