How to Configure Redis Object Cache on WordPress: Complete Setup Guide

Robert Halley

If your WordPress site feels sluggish under load, chances are your database is the bottleneck. Every uncached query, every transient lookup, every option fetch hits MySQL and adds milliseconds that pile up fast. Redis object cache for WordPress solves this by storing those queries in RAM, cutting response times dramatically.

In this guide, we walk through the complete setup process, from server requirements to plugin configuration, and share real benchmark data from a production WordPress site we optimized at Pixel Perfect Portfolios. If you’re a developer looking to squeeze serious performance out of your stack, this tutorial is for you.

What Is Redis Object Cache and Why Use It on WordPress?

WordPress has a built-in object cache, but by default it’s non-persistent. That means every page load rebuilds the cache from scratch. Redis (Remote Dictionary Server) is an in-memory key-value store that acts as a persistent backend for that cache, so queries and objects survive across requests.

The result is fewer database calls, faster time-to-first-byte (TTFB), and a site that can handle far more concurrent visitors without breaking a sweat.

Redis Object Cache vs Page Cache Plugins

A common confusion we see from developers: how does Redis object cache differ from WP Rocket, LiteSpeed Cache, or WP Super Cache?

Feature Redis Object Cache Page Cache Plugin
What it caches Database queries, objects, transients Full HTML pages
Best for Logged-in users, dynamic sites, WooCommerce Anonymous visitors, static content
Storage RAM (Redis server) Disk or RAM
Works with Complements page cache Complements object cache

The answer is: you should use both. They cache different layers of the stack.

redis server database

Server Requirements Before You Start

Before touching WordPress, make sure your environment meets these prerequisites:

  • Root or sudo access to your server (VPS or dedicated). Shared hosting typically won’t work unless Redis is pre-installed.
  • PHP 7.4 or higher (PHP 8.2+ recommended for 2026).
  • Redis server 6.0 or higher (7.x preferred).
  • PhpRedis PECL extension or Predis library.
  • WordPress 6.4+ with wp-config.php write access.

Step 1: Install Redis on Your Server

The commands below assume Ubuntu 22.04 or 24.04. Adjust for your distro.

sudo apt update
sudo apt install redis-server -y
sudo systemctl enable redis-server
sudo systemctl start redis-server

Verify Redis is running:

redis-cli ping

You should see PONG returned. If not, check the service status with systemctl status redis-server.

Basic Redis Configuration Tuning

Edit /etc/redis/redis.conf and adjust these values:

  1. Set maxmemory 256mb (or higher based on available RAM).
  2. Set maxmemory-policy allkeys-lru so older keys get evicted when memory fills.
  3. Bind to 127.0.0.1 only, unless you’re running Redis on a separate host.
  4. Restart Redis: sudo systemctl restart redis-server.

Step 2: Install the PhpRedis Extension

PhpRedis (the C extension) is significantly faster than Predis. Install it via PECL or your package manager:

sudo apt install php-redis -y
sudo systemctl restart php8.2-fpm

Confirm the extension loaded:

php -m | grep redis
redis server database

Step 3: Configure WordPress to Use Redis

Add these constants to your wp-config.php file, before the line that says /* That’s all, stop editing! */:

define('WP_REDIS_HOST', '127.0.0.1');
define('WP_REDIS_PORT', 6379);
define('WP_REDIS_TIMEOUT', 1);
define('WP_REDIS_READ_TIMEOUT', 1);
define('WP_REDIS_DATABASE', 0);
define('WP_CACHE_KEY_SALT', 'yourdomain.com:');

The WP_CACHE_KEY_SALT is critical if you host multiple WordPress sites on the same Redis instance. It prevents cache collisions between sites.

Step 4: Install the Redis Object Cache Plugin

Go to Plugins → Add New in your WordPress admin and search for Redis Object Cache by Till Krüss. Install and activate it.

Then navigate to Settings → Redis and click the Enable Object Cache button. If everything is configured correctly, you’ll see a green status: Connected.

Doing It via WP-CLI (Faster for Developers)

wp plugin install redis-cache --activate
wp redis enable
wp redis status

Step 5: Verify Redis Is Actually Caching

Don’t trust the plugin dashboard alone. Verify from the Redis side:

redis-cli
> INFO keyspace
> MONITOR

The MONITOR command streams live commands hitting Redis. Load a page on your WordPress site and you should see a flurry of GET and SET operations. If nothing appears, Redis isn’t wired up correctly. Source: https://chemicloud.com.

You can also check the object-cache.php drop-in exists in wp-content/. The plugin creates it automatically when you enable caching.

redis server database

Real-World Performance Benchmarks

We tested Redis object cache on a mid-sized WooCommerce site running on a 4 vCPU / 8GB DigitalOcean droplet. Here are the results using k6 with 50 concurrent virtual users over 5 minutes:

Metric Before Redis After Redis Improvement
TTFB (homepage) 842 ms 187 ms -77%
TTFB (cart page, logged in) 1,340 ms 395 ms -70%
DB queries per request 142 38 -73%
Requests/sec (peak) 47 189 +302%
Error rate 2.1% 0% -100%

The gains on logged-in pages (checkout, my-account, admin) are where Redis really shines, because page caching can’t help there.

Troubleshooting Common Issues

“Connection refused” error in the plugin

  • Confirm Redis is running: sudo systemctl status redis-server.
  • Check the bind address in redis.conf matches WP_REDIS_HOST.
  • Verify no firewall is blocking port 6379 if Redis is on a remote host.

Cache hit ratio is low

  • Increase maxmemory in Redis config.
  • Check that a poorly coded plugin isn’t calling wp_cache_flush() on every request.
  • Use redis-cli --stat to monitor memory usage in real time.

Site broke after enabling

Delete the wp-content/object-cache.php file. WordPress will fall back to the default non-persistent cache instantly, giving you time to debug.

Should You Use Redis Object Cache Pro?

The free plugin from Till Krüss is excellent for most use cases. Object Cache Pro is a paid commercial version with better compression, async flushing, and Relay support. If you’re running a high-traffic WooCommerce store or a membership site with thousands of concurrent logged-in users, it’s worth the license fee. For everyone else, the free version handles the job perfectly.

Frequently Asked Questions

Is Redis object cache better than Memcached for WordPress?

Both work well. Redis edges ahead because it supports data persistence, richer data types, and clustering. The WordPress ecosystem has also shifted toward Redis, so plugin support is broader.

Do I still need WP Rocket or LiteSpeed if I use Redis?

Yes. Redis caches database queries and objects, but page cache plugins serve pre-rendered HTML without even hitting PHP. Use them together for maximum performance.

How much RAM should I allocate to Redis?

Start with 256MB for a small site, 512MB to 1GB for medium sites, and 2GB+ for large WooCommerce or multisite installations. Monitor with INFO memory and adjust as needed.

Can I use Redis object cache on shared hosting?

Only if your host offers it. Most budget shared hosts don’t. Managed WordPress hosts like Kinsta, WP Engine, and Cloudways include Redis on higher plans. For full control, a VPS is the way to go.

Does Redis object cache work with WordPress multisite?

Yes, and it’s especially beneficial for multisite because network-wide queries benefit enormously from caching. Just make sure to set a unique WP_CACHE_KEY_SALT per network.

How do I clear the Redis cache?

From WordPress: go to Settings → Redis and click Flush Cache. Via WP-CLI: wp cache flush. Via redis-cli: FLUSHDB.

Final Thoughts

Setting up Redis object cache on WordPress takes about 20 minutes and delivers performance gains that would otherwise require upgrading your entire hosting plan. For any site handling logged-in users, WooCommerce transactions, or heavy database activity, it’s not optional in 2026, it’s essential.

At Pixel Perfect Portfolios, we implement Redis on every WordPress project we deliver. If you’d like our team to handle the optimization for you, get in touch and we’ll benchmark your current setup for free.

Leave a Comment