How to Speed Up Your WordPress Site with Redis Object Cache
Does your WordPress or WooCommerce site feel slow? The problem is likely too many database queries. Every time a visitor loads a page, WordPress fetches data from the database, which can slow things down.
The solution? Redis Object Caching!
With Redis, your database queries are stored in memory, making your website load much faster while reducing server load.
Step 1: Install Redis on Your Server
First, we need to install Redis on the server.
For cPanel/WHM Users (CentOS/AlmaLinux/Rocky Linux)
Connect to your server using SSH and run:
yum install redis -y
systemctl enable redis
systemctl start redis
This will:
- âś” Install Redis
- âś” Enable it to start on boot
- âś” Start Redis immediately
To check if Redis is running, run:
systemctl status redis
You should see “active (running)” in green.
Step 2: Install Redis Object Cache Plugin in WordPress
Now, we need to connect WordPress to Redis.
- Go to WordPress Admin > Plugins > Add New
- Search for Redis Object Cache (by Till KrĂĽss)
- Click Install Now and then Activate
Once activated, go to Settings > Redis and click Enable Object Cache.
✅ Redis should now show “Connected” status!
Step 3: Verify Redis is Working
Option 1: Use the Plugin Dashboard
- Go to Settings > Redis
- Check if Cache Hits are increasing. If so, Redis is working! âś…
Option 2: Test via SSH
Run this command in SSH:
redis-cli ping
If Redis is working, you’ll see:
PONG
You can also check Redis memory usage:
redis-cli info memory
Step 4: Optimize Redis for WooCommerce
Since WooCommerce is dynamic, we need to optimize Redis to ensure fast checkout and cart updates.
Exclude Cart & Checkout from Cache
- Go to WP Rocket > Advanced Rules
- Add
/cart/
,/checkout/
, and/my-account/
to the cache exclusion list.
Modify Redis Configuration
Edit the Redis configuration file:
nano /etc/redis.conf
Find and update:
maxmemory 512mb
maxmemory-policy allkeys-lru
Then restart Redis:
systemctl restart redis
Step 5: Final Performance Check
After setting up Redis, your site should be noticeably faster!
Test your TTFB (Time To First Byte):
curl -o /dev/null -s -w "%{time_starttransfer}\n" https://yourwebsite.com
âś… If your TTFB is under 200ms, Redis is working perfectly!
Final Thoughts
Redis Object Cache is one of the best ways to speed up WooCommerce stores, especially if your site has a lot of products or customers.
What You Gained Today:
- âś” Faster Page Load Times
- âś” Reduced Database Load
- âś” Improved WooCommerce Checkout Performance
- âś” Better Server Scalability
Bonus Tip: Combine Redis with Cloudflare CDN and WP Rocket for even faster speeds!
Leave a Comment
Comments (0)
No comments yet. Be the first to comment!