Redis is among the top WordPress caching tools to speed up your website. And that’s why it is globally available on every Hosting.express server as an optional installation.
Hosting.express believes in combining fast speeds, high performance, stability, and great support on its WordPress servers. Thus, it offers a PHP-powered stack with multiple cache layers, and the Redis Object Cache is a part of that layer.
This blog focuses on using Redis cache on your WordPress site and improving the site’s performance via cache plugins like Breeze. For more technically sound users, this article also covers how to use the Redis Object Cache with W3TC.
- What Is Redis and How Does It Work?
- How Does Redis Interact with WordPress Cache Plugins?
- Why Does WordPress need Redis?
- Precautions Before Enable Redis Cache on WordPress
- How To Activate Redis on Hosting.express Platform
- Method #1: By Using Redis Object Cache Plugin
- Method #2: By Using W3TC Plugin
- Redis Object Cache Response via SSH Terminal
What Is Redis and How Does It Work?
All Hosting.express servers use Memcached as an object cache by default. However, WordPress Redis is a more advanced and rich implementation that does everything Memcached offers and provides additional features.
Remote Dictionary Server (Redis) is an in-memory, persistent, key-value database known as a data structure server. One important factor differentiating Redis from similar servers is its ability to store and manipulate high-level data types (including lists, maps, sets, and sorted sets).
Redis’s caching mechanism speeds up WordPress database queries when combined with MySQL or MariaDB.
Redis’ performance, simplicity, and micro-data structure manipulation allows it to perform significantly better than traditional relational databases. Enabling Redis on Hosting.express servers is easy; keep reading to learn the steps to integrate Redis Object Cache on your WordPress sites hosted on Hosting.express
How Does Redis Interact with WordPress Cache Plugins?
Unlike traditional WordPress cache plugins, Redis is a server-side cache. WordPress cache plugins are built to accelerate a website’s frontend rendering by caching static versions of the pages that don’t run any code (for instance, the regular pages and posts that are served as static cached content).
Let’s say your WordPress site offers memberships and protects content and discounts for members on the connected WooCommerce store (which also sells courses made with your preferred LMS for WordPress). When choosing a cache plugin, it is important to consider factors such as ease of use, compatibility with your website, and the specific needs of your LMS. Once you have chosen a plugin, it is important to find a learning management system hosting that can support it and meet the requirements of your LMS.
All these plugins, plus their add-ons, mean that there could be 50 (or more) active plugins on your WordPress site.
We assume you already have a properly configured WordPress cache plugin for your pages. But things aren’t that fast in your WordPress Admin area because the dynamic content is not being cached.
Integrating Redis will result in a noticeable improvement in the backend operations, and drastically reduce the waiting times. Redis will cache and handle database queries and data structures to make your backend experience as fast as the frontend.
Why Does WordPress Need Redis?
A WordPress website with a laggy front and back end is disappointing. You can avoid poor user experiences and speed up your WordPress sites by integrating a caching mechanism like Redis cache.
With Redis enabled on a WordPress site, your visitors will get the content faster on your site. Usually, when a visitor requests data on a WordPress site, the backend starts doing MySQL query looks, which is time-consuming.
Redis stores important data in its memory that is readily delivered when requested to make things faster. So, Redis makes data retrieval faster, boosting performance and dramatically reducing response times.
Precautions Before Enabling Redis Cache on WordPress
Before enabling WordPress Redis cache on your WordPress site, you must take a few precautions. Ignoring these may directly affect your server and even result in bigger losses.
Create a Backup of Your Server
The first prerequisite is backing up your server so you have a safe restore point to revert to in case things go awry.
And it’s super easy with Hosting.express as it offers two backup options: on-demand and schedulable. The latter allows you to schedule the backup hourly, daily, and weekly.
The easy process is demonstrated in the image below, where you must make a few selections to manage backups securely.
Use Staging Environment
Developers advise testing all site changes in a staging environment. Even if things go back, your actual site remains unchanged and unharmed. And you learn about the consequences as well.
Once you are sure everything is working as intended, you can “Push” the changes to the live site. No changes are implemented to the live site until you “Push” them.
The staging environment is a replica of your existing website. It is not publicly available, and search engines can’t index a password-protected staging site.
Add Code in the WP Config File to Avoid Conflict
If your site is hosted on Hosting.express, you must make some changes in the wpconfig.php file to avoid any conflicts and run Redis smoothly.
Use an FTP software like FileZilla and PuTTy to access the wpconfig.php file. Follow the steps below:
- Log in to your FTP client.
- Connect to your host.
- Locate the public_html file folder
- Inside public_html, you’ll find the wp-config.php file.
- Open the wpconfig.php file on any text editor
- Add a line of code mentioned below just after the first line, PHP’s opening tag (<?php).
- define(‘WP_CACHE’, true);
Scroll down on the same file and find the Authentication Unique Keys and Salts section. Add the below-mentioned line of code to the first line.
- define(‘WP_CACHE_KEY_SALT’, ‘yoursite.com’);
The WordPress Cache Salt Key (yoursite.com in the example above) could be anything you like. It must be a unique key for every WordPress installation on that server. This way, we can be sure of Redis handling it properly.
Accelerate WordPress load times by 70%!
Improve your websites performance & score higher on Core Web Vitals with Cloudflare’s Edge Page Caching for WordPress!
How to Activate Redis on Hosting.express Platform
Hosting.express offers a quick one-click Redis installation. Follow the steps below:
- Log in to the Hosting.express platform.
- Navigate to Servers.
- Click Settings & Packages → Packages.
- Locate Redis, and click on the “Install” button next to it.
- Wait till your server package updates.
You’ll see a confirmation message at the top-right corner of the platform, notifying that the package has been updated.
If you are using any other PHP hosting or a provider that doesn’t provide the one-click Redis installation, you can still install Redis, but the process is: lengthy.
It contains the following steps, and each step takes its time.
- Access your server backend via SSH terminal
- Run multiple WP CLI commands to install Redis on your server.
- Once Redis has been installed on your server, configure it from your WordPress website.
There are two methods to configure Redis on your site, and here they are:
Speed-Up your WordPress Website
Slow-loading websites are the biggest turn-off for your visitors. Accelerate your sites with Managed hosting by Hosting.express
Method #1: Using Redis Object Cache Plugin
Before the Redis Object Cache installation and configuration, we recommend installing a caching plugin like the Breeze cache plugin to optimize your site’s front end.
Breeze and Redis are two separate caching systems. Breeze caches your site’s content for improved speeds, and WordPress Redis caches the queries, transients, and other data structures for the WordPress Admin. So, with Breeze and Redis together, you get an optimized front end and back end.
Install Redis Object Cache Plugin
Follow the steps below to install the Redis Object Cache plugin to your WordPress site:
- Log in to your WordPress site.
- Go to your WordPress Admin dashboard.
- Click Plugins → Add New.
- Search for Redis Object Cache.
- Click on the Install button.
- Activate the plugin by clicking on the Activate button.
- After the activation, you’ll be redirected to Settings. Click Redis.
- You will see the Drop-in is invalid status.
- Click on the Enable Object Cache button to enable the status.
- Once the object cache is enabled, the status will change to Connected.
- You will see a Flush Cache button on the bottom of the page. Let’s understand the use and need of this button.
We usually don’t need to flush the object cache. Still, it is sometimes the only saving grace when backend operations don’t work correctly, like the need for activating or deactivating a plugin activation.
The Flush Cache option is just for the object cache and is a good practice to Flush or Purge all the other caches.
Breeze, Varnish, and other cache plugins have dedicated Flush or Purge cache options that clean out unnecessary files from your site.
You can also purge the varnish cache from the Hosting.express platform.
- Navigate to Servers → Manage Services.
- Click on the PURGE button.
And to check if Redis is caching your backend operations, follow the steps below:
- Go to your WordPress Admin dashboard.
- Click Settings → Breeze.
- Click Database Options.
If Redis Object Cache is disabled, you will see a few transient options to optimize:
Once you have enabled Redis Object Cache, you will see the transient options as 0 (zero), meaning Redis is caching them instead of WordPress storing them.
Method #2: Using the W3TC Plugin
W3 Total Cache is a popular plugin that gives you full control over all aspects of system-wide caching. It provides many settings with several options and sub-options. When properly configured, it’s powerful and fast.
You don’t need any additional plugins to set up Redis Object Cache with W3 Total Cache. Follow the steps below:
- Go to the WordPress Admin → Performance.
- Click General Settings → Object Cache.
- Mark the checkbox Enable to activate the option.
- Select Redis from the drop-down menu.
- Click Save Settings & Purge Caches.
Object Cache is now enabled on your site via W3 Total Cache Plugin.
Now it’s time to test the Redis Object Cache response via SSH terminal.
Testing Redis Object Cache Response via SSH Terminal
Running a simple WP CLI command helps you check if Redis Object Cache is working fine. Follow the steps below:
- If you are a Hosting.express user, log in to the Hosting.express platform.
- Click Servers and select your Server.
- Click Master Credentials under Server Management.
- Click on the Launch SSH Terminal button.
- You’ll be redirected to a new tab.
- Enter the server’s Master Credentials (username and password).
- Run the below-mentioned WP CLI command.
- redis-cli monitor
- Hit the Enter button.
If everything is configured correctly, you will get the message OK, followed by the pages Redis is caching.
This tutorial guides you on configuring Redis Object Cache support for your WordPress sites. This implementation aims to speed up your backend operations by persistent caching queries, transients, and fundamental data structures.
Hosting.express collaboration with Redis Object Cache is an outcome of our customers’ feedback.
Even though we already had Varnish and Memcached available in our arsenal, we still went one step ahead for maximum speed boosts. A basic WordPress site hosted on Hosting.express with Breeze can load in just 79ms.
If your site is not hosted on Hosting.express, you’re missing on the speed boosts. Request a Hosting.express product demo & learn about the product, its features, and how it works to help speedify your website.
Q: Is Redis good for WordPress?
A: Redis Object cache speeds up your WordPress load time with each subsequent visit. The data serves faster next time the request generates, so the database doesn’t have to be queried again.
Q: How do I enable Redis cache in WordPress?
A: First, Install and Activate the Redis Cache Plugin on your WordPress website. Go to WordPress Settings > Redis, and click on the Enable Object Cache button.
Q: What is Redis in WordPress?
A: Redis is a fast caching solution for server-side applications such as WordPress. This open-source key-value store operates as an in-memory store and a cache.
Q: Is Redis cache free?
A: Redis Object Cache is a freemium plugin. You can use its limited features for free, but if you want to use the advanced features, you’ll have to get Object Cache Pro for $95/month.
Q: How do I turn off the Redis cache in WordPress?
A: You can disable the Redis Object Cache from the WordPress Settings. Go to Settings > Redis, and click on the Disable Object Cache.
Q: What is the difference between memcached vs redis object cache?
A: Redis stores the data in specific data types, whereas Memcached only stores data as strings. Redis reduces network overhead because of the data types, speeding up the scenarios and reducing the network I/O counts and data sizes.