Redis is the world’s fastest in-memory database. It provides cloud and on-prem solutions for caching, vector search, and NoSQL databases that seamlessly fit into any tech stack—making it simple for digital customers to build, scale, and deploy the fast apps our world runs on.
About – Redis
If you’ve seen this alert on your WordPress website:
You should use a persistent object cache Performance
A persistent object cache makes your site’s database more efficient, resulting in faster load times because WordPress can retrieve your site’s content and settings much more quickly.
Your hosting provider can tell you if a persistent object cache can be enabled on your site.
You can resolve it by installing Redis on your Linux server and integrating it with your WordPress installation by following these steps!
- Install Redis on Linux:
- Most major Linux distributions provide packages for Redis. We’ll focus on Ubuntu/Debian here.
- Open a terminal and run the following commands:
# Install prerequisites (if needed)
sudo apt install lsb-release curl gpg
# Add the Redis repository to the apt index
curl -fsSL [^1^][1] | sudo gpg --dearmor -o /usr/share/keyrings/redis-archive-keyring.gpg echo "deb [signed-by=/usr/share/keyrings/redis-archive-keyring.gpg] [^2^][2] $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/redis.list
# Update the package index
sudo apt-get update
# Install Redis
sudo apt-get install redis
- Install the Redis PHP Extension:
- To communicate with Redis from PHP (which WordPress uses), you’ll need the PHP extension.
- Install it using the following command:
sudo apt-get install php-redis
- Configure the Redis WordPress Plugin:
- Log in to your WordPress admin dashboard.
- Go to “Plugins” → “Add New”.
- Search for “Redis Object Cache” and click “Install Now”.
- Once installation is complete, click “Activate” to enable the plugin.
- Go to “Settings” → “Redis” to configure the plugin.
- Ensure it starts on Startup
- When you first install Redis, it may work fine but when you restart the server you’ll notice it’s not running. To make sure it’s running on startup type the following:
sudo systemctl enable redis-server
- When you first install Redis, it may work fine but when you restart the server you’ll notice it’s not running. To make sure it’s running on startup type the following:
- Test that Redis is Running
- To test that Redis is running, type:
redis-cli ping
- If you get a message that says, Could not connect to Redis at 127.0.0.1:6379: Connection refused it means that Redis is not running and you need to Start it. If it’s running, it’ll say Pong
- You can also type:
sudo systemctl status redis-server
which should return something like:
- To test that Redis is running, type:
- To Start Redis on your server:
- Type:
sudo systemctl start redis-server
- Type:
- Test and Monitor:
- Visit your WordPress site and ensure that the Redis cache is working.
- Monitor your site’s performance and load times.
Remember to adjust any additional settings based on your specific server environment. Redis caching will significantly boost your WordPress site’s performance!