Blog · WebJi® India

Redis Object Cache for WordPress

Quick answer: Redis object cache stores WordPress query results in memory so the next request skips MySQL. You need a Redis server and the PHP Redis extension, then the Redis Object Cache plugin. It is working when the plugin shows Connected and hits climb. Page cache still serves anonymous HTML.
✓ In business since 2005✓ INR + GST billing✓ 24/7 Email Support — avg reply < 60 min
Person comparing performance charts on two monitors
Person comparing performance charts on two monitors

What does a Redis object cache store?

WordPress already keeps an object cache, and that copy dies when the request ends. Redis holds the same kind of objects for the next visit. The usual keys are options, menus, user meta, and transients saved with set_transient.

Page cache is a separate store. It saves finished HTML for visitors who are not logged in. Redis does not replace that HTML. It cuts PHP work on screens the page cache must skip, such as wp-admin, a cart, and an account page.

LayerWhat it keepsWho it speeds up
Page cacheFinished HTMLAnonymous visitors
Redis object cacheQuery results and transientsLogged-in and dynamic pages
Browser cacheCSS, JavaScript, and imagesThat one browser

Keep the page cache on. After you change a post, clear the WordPress page cache so visitors see the new HTML. Flushing Redis does not publish that edit.

What has to be running before the plugin works?

The plugin is a client. Enable does nothing until the server already has both of these.

  • Redis server. It should listen on 127.0.0.1 port 6379, or on a Unix socket the PHP user can open.
  • PHP Redis extension. Load phpredis for the same PHP version WordPress uses. Predis is only a PHP library. It is not the Redis server.

A shared account will not let you install redis-server or a PHP extension. Those packages need root on a VPS.

Use Linux for this job. Ubuntu, Debian, and AlmaLinux can install the packages. Windows Server on a VPS is a different install, and it is not the path here.

On Ubuntu or Debian, install the redis-server package and php-redis, then restart PHP. On AlmaLinux, install the PHP Redis package that matches the site PHP version. In SSH, redis-cli ping should print PONG. A connection refused reply means the daemon is stopped or not bound to localhost.

How do you enable Redis object cache in WordPress?

Use one object-cache plugin. Redis Object Cache is the common choice. Leave LiteSpeed object cache and the Redis method inside W3 Total Cache switched off. Two clients both try to own wp-content/object-cache.php.

  1. In wp-admin, install and activate Redis Object Cache. Do not click Enable until redis-cli ping returns PONG.
  2. If Redis is not on 127.0.0.1 port 6379, set the host in wp-config.php above the line that says to stop editing. A socket needs WP_REDIS_SCHEME set to unix and WP_REDIS_PATH set to the socket file. Each extra site on the same Redis needs its own WP_REDIS_DATABASE or WP_REDIS_PREFIX.
  3. Open Settings, then Redis, and click Enable Object Cache. The status should say Connected, and WordPress should write wp-content/object-cache.php.
  4. Load wp-admin twice. The second view should add hits. A column of misses only means keys are not being stored.

It worked when Enable is still on after you reload Settings and the drop-in file is still in wp-content. If the button returns an error, fix the server connection before you flush any keys.

How do you check that Redis is caching?

Settings, then Redis, lists Status, Hits, and Misses. A new site is mostly misses. After normal browsing, hits should pass misses. Hits stuck at zero means PHP is not talking to Redis.

On the server, redis-cli info stats prints keyspace_hits and keyspace_misses. Reload wp-admin and run the command again. Those counters should move. redis-cli info memory prints used_memory_human. If that figure is pinned to the memory cap, Redis is evicting keys and the hit rate will stall.

Predis library not found means the plugin has no PHP client. Install the PHP Redis extension, or reinstall the plugin so its library is present. Delete wp-content/object-cache.php only while object cache is disabled. Removing that file while the cache is enabled can break every front-end request.

Where does Redis help a WooCommerce shop?

Carts, sessions, and many product lookups belong to one shopper. The page cache has to skip them, or the next visitor would see the previous cart. Redis can keep those objects between requests. That is the part that slows checkout.

A small catalogue that is already page-cached will not feel faster to anonymous shoppers. The change shows in wp-admin, on the cart, and when many people check out together. WooCommerce hosting still needs the page cache for product HTML. Redis sits beside it.

When should you leave Redis object cache off?

Redis will not shrink a large image, fix a heavy theme, or speed a page that waits on an outside payment API. If a logged-out page is already quick and MySQL is quiet, more memory for Redis will not move the score.

Memcached is another object-cache backend. Choose Redis when the Redis server and the PHP Redis extension are what you can install. Do not send the same site to both backends.

Leave the plugin off when there is no Redis server. Do not open Redis to the public internet. Bind it to 127.0.0.1. If the connection test fails after a move, email the time and the Settings message to support@webji.services. Do not call the office number. That line is not a support queue.

Frequently Asked Questions

What does Redis object cache do in WordPress?

It keeps WordPress objects in memory between requests. Options, menus, transients, and many WooCommerce lookups are reused instead of hitting MySQL again. It does not store the finished HTML. That remains the page cache.

How do I enable Redis object caching in WordPress?

Confirm redis-cli ping returns PONG and that the PHP Redis extension is loaded. Install the Redis Object Cache plugin, set the host in wp-config.php if Redis is not on 127.0.0.1, then click Enable Object Cache. Connected, plus wp-content/object-cache.php, means it is on.

Can Redis object cache run on shared hosting?

Only if that account already provides a Redis server and a PHP client. A normal shared plan will not let you install redis-server or the PHP Redis extension. Use a VPS with root, install both, and then enable the plugin.

How do I check if Redis is caching my WordPress site?

Open Settings, then Redis. Status should say Connected, and hits should rise as you browse. On the server, redis-cli info stats should show keyspace_hits increasing. A screen that stays on misses is not saving queries.

What is the difference between page cache and object cache?

Page cache stores finished HTML for anonymous visitors. Redis object cache stores database results and transients for the next PHP request, including logged-in screens the page cache skips. Use both. Clearing one does not clear the other.

What does Predis library not found mean?

The plugin cannot load a PHP client. Install the PHP Redis extension for the site PHP version, or reinstall the plugin. If a broken wp-content/object-cache.php is left behind, delete it only while object cache is disabled, then enable the plugin again.

Need help with this?

WebJi® support does it for you — free. Talk to our Jaipur team →