Redis is a type of memory based database and can be used to enable Object Caching on your WordPress site.
Object caching is essentially a form of database caching and can help speed up sites that are particularly database heavy such as WooCommerce sites, membership sites and content sites with a busy backend. In a nutshell, using Object Caching and Redis will help make database queries faster.
Not all sites will benefit from this so we don’t do this by default as it adds extra complexity that a typical small business site doesn’t necessarily benefit from.
There are a few steps you MUST complete in order to set this up correctly.
Add a cache salt key to wp-config
You MUST add a cache salt key line into your wp-config.php file in the root folder of your WordPress installation. This file is responsible for your core WordPress configuration.
This line ensures that data stored in Redis is uniquely keyed to your site. If you don’t do this it can lead to data corruption and strange behaviour on your site.
Add the line below and randomize the characters in the key, DO NOT just copy this key
define('WP_CACHE_KEY_SALT', 'RANDOMSTRINGGOESHERE' );
…so in practical terms, the line should look something like
define('WP_CACHE_KEY_SALT', '=tepsyUyBEVNd-S8V3I>=wu4-e-yW-5T]jK_H{A{IjYu#aS<mWK&_&' );
There will most likely be other keys in a block in your wp-config file, place this one underneath them.
Install the Redis Object Cache Plugin
Install the Redis Object Caching plugin from here: https://wordpress.org/plugins/redis-cache/
….then open the settings and enable it.
That’s it, you’re all done!
