Redis object cache can improve performance for some websites that perform heavy database queries. It reduces the number of queries to the database by caching results from previous queries, resulting in faster page load times and a better user experience for some database-heavy websites and applications.
However, if your site does not need Redis, we recommend not enabling it, as it can sometimes (but not always) degrade website performance on high performance servers.
Secure, Isolated Redis for Multi-user Environments
Traditional Redis is insecure when used on servers with multi-user environments and shared hosting servers, as one user can easily access and modify another user's data stored in Redis.
We deploy isolated Redis instances for each user, which remain encapsulated and completely separate from other users' instances. One user cannot access or alter other users' Redis data, and one user's issues cannot impact another user's Redis instance, making it safe to use in multi-user and multi-website environments.
IMPORTANT!
Do not enable Redis in multiple plugins on the same website. Doing so can create conflict. If Redis is enabled in the LiteSpeed Cache for WordPress plugin, do not enable it in the Redis Object Cache plugin or any other plugin.
If you have multiple websites in the same cPanel/DirectAdmin account, specify a different "Redis Database ID" for each website to avoid key conflicts. You can set the "Redis Database ID" to any number from 0 to 7, e.g., 0 for the first website and 1 for the second, but not decimal values like 1.2. You can use a maximum of 8 databases (0 to 7) in a hosting account (cPanel/DirectAdmin account).
Step 1: Enable Redis in cPanel/DirectAdmin
cPanel:
Redis is integrated into the LiteSpeed Web Cache Manager in cPanel:
- Go to cPanel > Redis Object Cache.
Or, cPanel > LiteSpeed Web Cache Manager. - Click "Enable Redis Service" below "Redis Management".
Wait for it to be enabled.
Once enabled, a notification will appear near the top of the page saying, "Enabled Redis successful Created symlink". - Done!
DirectAdmin:
- Go to DirectAdmin > Redis.
- Click on the toggle next to Redis to enable it.
Once enabled, a "Success" message will appear near the bottom of the page. - Done!
Step 2: Enable Redis PHP Extension
- Go to cPanel > Select PHP Version > Extensions.
Or, DirectAdmin > Select PHP Version. - Checkmark [*] redis
Please wait 15-40 seconds to enable the Redis extension.
Refresh the page to update its status. - Done!
Step 3: Enable Redis in WordPress
Redis is integrated into the LiteSpeed Cache for WordPress plugin:
- Install LiteSpeed Cache for WordPress.
LiteSpeed Cache is a full-page cache with native CDN integration and support for dynamic content (WooCommerce, logged-in pages, etc.). It makes your website much faster and reduces resource consumption lower than Redis, even when Redis is disabled. - Go to WordPress Admin > LiteSpeed Cache > Cache > Object.
- Check if Redis Extension status is enabled (next to Object Cache):
Redis Extension:Enabled
If not enabled, complete Steps 1 and 2 above. - Set "Object Cache" to ON.
- Set "Method" to Redis.
- Enter the following details:
Host:/tmp/redis.sock
Port:0
Redis Database ID:0
Note 1:
Redis Database ID should be a unique number for each website.
If you have other websites using Redis on the same hosting account (same cPanel/DirectAdmin account), the default value 0 is used for the first website.
For the next website, set it to 1 or any value up to 7, but not 0.
Note 2:
Host path on DirectAdmin is different. Use the path mentioned below on DirectAdmin-based hosting accounts. - Click "Save Changes".
Connection test should now reflect the following (next to Object Cache):
Connection Test:Passed
- Done!
Redis has now been enabled.
Redis Socket Path on DirectAdmin
DirectAdmin uses a different path for the Redis Socket. You can view the path from DirectAdmin > Redis. You can also use the following:
Socket Path: /home/dausername/.redis/redis.sock
*Replace dausername
with your DirectAdmin username
.