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.
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.
The Redis Object Cache plugin enables you to easily set up your WordPress site to use Redis.
By default, Redis Object Cache uses the WordPress database table prefix defined in wp-config.php for its own key prefix in the Redis cache. If you have multiple WordPress sites that use the same MySQL table prefix, content from the sites can become mixed together in the Redis cache and cause site display problems. Note that this scenario only happens if all of the following conditions are true:
In such a scenario, you can disable Redis Object Cache and the site display issues will be resolved. Consider changing the sites' database table prefixes, or changing the cache key prefix for Redis Object Cache. For more information, please see https://github.com/rhubarbgroup/redis-cache/wiki.
To install and configure Redis Object Cache on your WordPress site, follow these steps:
Locate the Redis Object Cache section, and then click Install Now:
When installation is complete, click Activate. The Redis Object Cache page appears:
Configure the plugin:
If you have a Turbo shared or reseller account, follow these steps:
define( 'WP_REDIS_SCHEME', 'unix');
define( 'WP_REDIS_PATH', '/home/username/.redis/redis.sock');
You do not need to do anything further to take advantage of performance improvements from Redis caching. The following options are available:
To install and configure WP Redis on your WordPress site, follow these steps:
Locate the WP Redis section, and then click Install Now:
If you have a Turbo shared or reseller account, follow these steps:
$redis_server = array(
'host' => '/home/username/.redis/redis.sock',
);
To enable the object cache, type the following command:
wp redis enable
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
Subscribe to receive weekly cutting edge tips, strategies, and news you need to grow your web business.
No charge. Unsubscribe anytime.
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.
We use cookies to personalize the website for you and to analyze the use of our website. You consent to this by clicking on "I consent" or by continuing your use of this website. Further information about cookies can be found in our Privacy Policy.