Redis Object Cache for WordPress
Redis object cache keeps reusable WordPress objects between requests so compatible code can avoid repeated database work. It needs a running Redis server, a supported PHP client and one object-cache integration. Confirm the plugin shows Connected, measure actual response time and isolate each site’s disposable cache. It complements page caching rather than replacing it.
For WordPress and WooCommerce owners with a slow wp-admin or busy logged-in traffic who can run commands on their own server.
knowledge
- Read time
- 4 min
- Sections
- 6
- Updated
- 14 Nov 2026
- Written by
- WebJi® team
Last editorial update: 14 November 2026.
What Redis object cache stores for WordPress
Redis object cache keeps WordPress objects between requests, allowing later lookups to reuse cached data instead of repeating database work. WordPress has a per-request object cache already; a persistent backend extends its lifetime beyond the end of a PHP request.
Objects can include options, metadata, query results and transients where the application uses the WordPress caching APIs. Redis does not automatically cache every SQL query. The application and plugins decide what they store and how they invalidate it.
| Layer | Stores | Useful for |
|---|---|---|
| Page cache | Finished HTML | Eligible anonymous page requests |
| Redis object cache | Reusable WordPress objects | Dynamic requests, administration and logged-in activity |
| Browser cache | Static resources in the visitor's browser | Repeated asset downloads |
These layers are complementary. Clearing WordPress caches explains why purging object data is not the same as purging a page cache's finished HTML.
What Redis object cache needs before installation
Redis object cache needs a running Redis server, a compatible PHP client and a WordPress cache integration; the plugin alone cannot supply the server. Confirm all three before enabling the persistent cache.
- Redis service: reachable over a local socket or a protected connection.
- PHP client: PhpRedis for the site's PHP version, or the plugin's supported Predis client.
- WordPress integration: Redis Object Cache, or one alternative object-cache implementation, not competing drop-ins.
- Administration access: permission to install server packages and restart services, unless the host has already provisioned them.
- Memory budget: a dedicated cache allocation that leaves enough RAM for PHP and the database.
The Redis Object Cache maintainer documentation confirms the clients, constants and WP-CLI commands. A typical shared account cannot install its own daemon; a Linux VPS gives an administrator the necessary control.
How to prepare the Redis server for WordPress
Prepare a local Redis service and the matching PHP client, then verify the daemon and the PHP runtime separately. Package names and service names depend on the distribution and PHP packaging in use.
For a Debian or Ubuntu installation using distribution packages, this is a starting procedure:
sudo apt update
sudo apt install redis-server php-redis
sudo systemctl enable --now redis-server
redis-cli -h 127.0.0.1 ping
php -m | grep -i redis
Expect PONG from redis-cli. The final command checks command-line PHP only; WordPress may use another PHP version or FPM pool. Confirm the web runtime and restart that site's PHP service after installing its extension. Do not assume a package for default PHP also configures a panel-managed PHP version.
AlmaLinux uses a different package stack. Install Redis and the extension matching your PHP repository, confirm the actual service name, then perform the same connection checks. Do not mix extension packages from unrelated PHP builds.
For a Redis instance dedicated entirely to disposable cache data, an illustrative memory configuration is:
maxmemory 256mb
maxmemory-policy allkeys-lru
Adjust the 256 MB example to your measured workload. The eviction policy can remove any key, so do not apply it to an instance also holding sessions, queues or other data that must persist. Keep Redis on loopback or a restricted socket; do not expose port 6379 to the public internet.
How to enable Redis object cache in WordPress
Install Redis Object Cache, define its connection settings before WordPress loads, then enable its object-cache drop-in. Back up wp-config.php first and disable any competing object-cache feature.
- Confirm Redis is reachable from the site's PHP environment.
- Install and activate Redis Object Cache through Plugins → Add New.
- Add the required constants above the stop-editing line in wp-config.php.
- Open Settings → Redis and choose Enable Object Cache.
- Confirm Connected, then browse representative public and logged-in pages.
define( 'WP_REDIS_HOST', '127.0.0.1' );
define( 'WP_REDIS_PORT', 6379 );
define( 'WP_REDIS_PREFIX', 'shop1_' );
define( 'WP_REDIS_DATABASE', 0 );
A prefix prevents naming collisions; it is not a security boundary. Give each independent site's disposable cache its own logical database or instance where appropriate. A database-wide flush can affect every site's keys in that database even when their prefixes differ.
For an existing Unix socket, use its actual path and permissions instead of TCP:
define( 'WP_REDIS_SCHEME', 'unix' );
define( 'WP_REDIS_PATH', '/var/run/redis/redis-server.sock' );
Use either TCP or socket settings to match the deployment, not an invented socket path. With WP-CLI, run these from the WordPress installation as its authorised site user:
wp plugin install redis-cache --activate
wp redis enable
wp redis status
How to verify and safely disable Redis object cache
Verify Redis with the plugin connection status, cache activity and measured application response time; a hit counter alone is not proof of a useful speed improvement. Compare the same workload before and after enabling it.
redis-cli -h 127.0.0.1 info stats
redis-cli -h 127.0.0.1 info memory
wp redis status
keyspace_hits and keyspace_misses are server-wide counters, not a per-site benchmark. Activity can come from other databases and applications. Inspect evictions and memory use alongside timing; reaching the memory cap does not by itself prove the cache has failed.
If a connection error breaks the site, the plugin documents an emergency bypass. Add this before WordPress loads in wp-config.php:
define( 'WP_REDIS_DISABLED', true );
Use wp redis disable for the normal drop-in removal path once administration works. Avoid an indiscriminate flush on a shared instance. Check ownership and database scope before clearing keys, and do not treat the cache as a backup of your WordPress database.
When Redis object cache is useful for WordPress
Redis object cache is most useful when repeated object lookups contribute to slow dynamic requests, not when images or an external API dominate the delay. Choose it after identifying the bottleneck.
WooCommerce carts, account areas, membership pages and wp-admin commonly bypass a public page cache. A persistent object backend can help those requests reuse suitable data, but checkout still needs correct application logic and database writes. Never cache another customer's personalised page as public HTML.
A small page-cached brochure site may gain little. Measure first, then decide whether the added service, memory and operational work are justified. WooCommerce hosting addresses the hosting environment; Redis is one component rather than a substitute for the rest of the stack.
Keep one object-cache integration active, document its recovery switch and include it in migration testing. A server move changes connection details even when the WordPress files have been copied correctly.
Redis object cache questions
Is PhpRedis mandatory for the Redis Object Cache plugin?
No. The plugin also supports Predis and other documented clients. PhpRedis is a PHP extension, while Predis is a PHP library; neither is the Redis server. Verify the chosen client in the site's web PHP environment before troubleshooting the daemon.
Will one prefix protect different customers sharing Redis?
A unique prefix avoids key collisions but does not isolate access. Independent customers need an appropriate security boundary and permissions. Separate databases can reduce accidental flush overlap, while separate instances or properly configured access controls address stronger isolation requirements.
Should I flush Redis after every WordPress edit?
No. WordPress and compatible integrations should invalidate the affected objects. Routine full flushes remove useful cached data and can increase database work. Purge the relevant page-cache layer when edited HTML remains stale, and investigate incorrect invalidation instead of constantly flushing everything.
Does Redis replace a database backup?
No. Object-cache entries are disposable copies used for acceleration, not the authoritative WordPress data. Keep normal database and file backups. Configuring persistence for Redis does not turn that cache into a tested recovery process for your whole website.
Plugin configuration checked 14 November 2026 · Reviewed by the WebJi® team, Jaipur.
Ready to get started with WebJi®?
Join 12,000+ businesses across India and overseas. INR pricing, 18% GST shown before payment and 24/7 email support in Hindi and English — average first reply under 60 minutes.