Skip to content

Home / Blog

Explainer

Redis Object Cache in WordPress: What It Does, When to Use It

Redis Object Cache in WordPress: What It Does, When to Use It

A Redis object cache in WordPress is fast memory that stores the results of repeated database queries, so the next request gets them ready-made instead of asking the database again. Redis or Memcached provide this “persistent object cache”. It pays off most on pages that cannot be fully cached, such as the dashboard, the cart and checkout; a small brochure site served from page cache gains much less.

This guide explains the idea in plain terms, separates it from page caching, compares Redis with Memcached, and shows when to enable object caching and how to confirm it is actually working.

What is object caching in WordPress?

Object caching means keeping the results of repeated work, such as database queries, in memory so they can be reused instead of recalculated. WordPress already does this, but only within a single request.

To build one page, WordPress asks the database dozens of questions: site settings, posts, user data, menus, plugin options. The WP_Object_Cache class keeps those answers in memory so the same question is not asked twice while the page is built. But as the official WordPress reference explains, this cache is non-persistent by default: it is wiped at the end of the request and nothing is kept between page loads unless you install a persistent caching plugin.

A persistent object cache fixes that. The plugin places a drop-in file called object-cache.php in wp-content, WordPress loads it instead of the default cache, and the results are stored in a separate memory service such as Redis or Memcached, where they survive between requests and between visitors.

Think of a receptionist asked for product prices. Without memory, they walk to the warehouse every time. With a persistent cache, they jot the popular prices on a note at the desk and only walk to the warehouse for what is not on it.

Page cache vs object cache: what is the difference?

A page cache stores the whole finished page; an object cache stores the pieces the page is built from. The first skips WordPress entirely; the second makes WordPress faster when it has to run.

Page cache Object cache
What it stores A complete HTML page Query results and repeated data
Does PHP run? No, the stored copy is sent directly Yes, but with fewer database queries
Who benefits Logged-out visitors on public pages Dashboard, cart and checkout, logged-in members
Examples LSCache Redis, Memcached

The two complement each other. On a LiteSpeed server, LSCache handles full pages, as we explain in what is LiteSpeed and why it matters for WordPress, while Redis or Memcached speeds up the requests that cannot be fully cached.

Redis or Memcached: which should you choose?

For a typical WordPress site, both do the job well. Redis is a very common choice with more features; Memcached is simpler and lighter. Pick what your host provides and your plugin supports.

Redis is an in-memory data store that supports several data types and can optionally save a copy to disk. Memcached is a simple in-memory key-value store that is not designed for durable storage.

Feature Redis Memcached
Where data lives Memory Memory
Data types Several (lists, sets, hashes and more) Key-value only
Saving to disk Optional Not designed for it; data is normally lost on restart
Separating sites Numbered databases inside the service Key prefixes
WordPress plugins LiteSpeed Cache, Redis Object Cache LiteSpeed Cache

On a small or medium site, these technical differences rarely matter. What matters is a healthy connection, a single active plugin, and checking the effect by measuring.

When does a Redis object cache help WordPress?

Object caching helps when many requests reach WordPress without being served from the page cache. The main cases:

  • WooCommerce stores. Cart, checkout and My Account must stay dynamic because they show data specific to each customer, as the WooCommerce documentation explains. Those pages hit the database on every request, which is where Redis shows its value, especially during busy seasons such as Ramadan and big sales. For more, see small WooCommerce store hosting.
  • Membership and course sites. Logged-in users usually see personalised pages that cannot be fully cached.
  • Busy dashboards. If several editors work in the site every day, every click in wp-admin is a fresh round of database queries.
  • Query-heavy plugins. Some plugins ask the database the same thing over and over; an object cache saves the repeats.

When does it help less?

  • A small brochure site whose visitors are mostly logged out and served from page cache.
  • Queries that never repeat, such as unique searches with different words each time; there is nothing to reuse.
  • Front-end slowness, like huge images or heavy JavaScript. No server cache fixes those; see why is my website slow?

How do you enable Redis or Memcached in WordPress?

If your host provides the service, it takes a few minutes in one plugin. These steps use LiteSpeed Cache, the natural fit on LiteSpeed servers:

  1. Take a backup, or work on a staging copy if you have one.
  2. Get the connection details. You need a host and port, or a local socket path. If you are unsure, ask your host’s support.
  3. Open the settings. In WordPress: LiteSpeed Cache → Cache → Object tab.
  4. Turn Object Cache on and set Method to Redis or Memcached.
  5. Enter the connection details. The LiteSpeed documentation notes that connecting through a socket is common and more efficient; in that case you put the socket path in Host and set Port to 0.
  6. Save and check the status. The same tab shows the connection status. If it reports an error, recheck the details before anything else.
  7. Measure the effect. Compare dashboard and cart speed before and after. The Query Monitor plugin shows the number of database queries on each page, so you can see the difference in numbers.

If you do not use LiteSpeed Cache, the Redis Object Cache plugin is a well-known option for connecting to Redis. Just never run two plugins for the same job.

Worth knowing: with object caching enabled, LiteSpeed Cache stores transients (temporary data saved by WordPress and plugins) in Redis or Memcached instead of the database, so expired transients stop piling up in the options table.

Common mistakes and how to avoid them

  • Two object cache plugins at once. WordPress uses a single object-cache.php, and a second plugin may overwrite it or conflict with it. Choose one.
  • Stale data after edits. LiteSpeed’s documentation warns that caching wp-admin can occasionally return stale data. If you see it, purge the object cache from the plugin settings.
  • Several sites on one Redis service. Give each site its own database number or key prefix so their data never mixes. This matters for freelancers and agencies.
  • Forgetting to purge after a migration or restore. After moving a site or restoring a backup, flush the object cache so old data is not served.
  • Expecting miracles. An object cache lightens the database load, but it will not fix a badly coded plugin or a 5 MB image.

Redis and Memcached at Start Bigger

Every Start Bigger hosting plan includes Redis and Memcached alongside LiteSpeed with LSCache and NVMe storage, so page caching and object caching come on the same plan. WP Toolkit gives you a staging copy to test settings before touching the live site, and our support in Arabic and English covers WordPress performance and common plugin problems if you need help with the connection details.

If you would rather not handle updates, backups and security yourself, our Managed Site service takes care of them for one WordPress site while you keep dashboard access.

In short

  • An object cache keeps repeated query results in memory; in WordPress it is only persistent with Redis or Memcached and a suitable plugin.
  • Page caching serves logged-out visitors; object caching speeds up the dashboard, cart and checkout. They work together.
  • Redis is a common, feature-rich choice and Memcached a solid alternative; use what your host offers.
  • Run one plugin only, confirm the connection status, and measure before and after.

Frequently asked questions

Do I need Redis if I already use the LiteSpeed Cache plugin?

Usually yes, if your site has pages that cannot be fully cached. LiteSpeed Cache handles full-page caching, but it does not provide object caching itself; it connects to an external service such as Redis or Memcached. The two work together rather than competing.

Can Redis make my site slower?

It can if the connection settings are wrong or two object cache plugins are active at once. Enable it on a staging copy first, confirm the connection status is healthy, and compare dashboard and cart speed before and after.

Will I lose data if the Redis cache is cleared?

No. Redis holds a temporary copy of data that already lives in your database. If the cache is emptied, WordPress fetches the data from the database again and re-caches it, so the first few requests may be slightly slower before things return to normal.

Should I enable Redis and Memcached together?

No. WordPress uses a single object cache drop-in, so pick one service and one plugin to connect to it. Redis is a very common choice for WordPress, and Memcached is a solid alternative if that is what your host offers.

Does Redis help a small WooCommerce store?

Usually, yes. Cart, checkout and My Account pages are not fully cached and hit the database on every request. An object cache cuts the repeated queries on those pages, and the benefit shows most during busy sale seasons.

Read next

Guide

Why Is My Website Slow? Hosting Causes and Fixes

A practical guide to diagnosing a slow website: how to measure with Core Web Vitals, how to tell whether the hosting or the site is to blame, and what to fix first.

Jordan & Gulf

Does Server Location Matter? Germany, the Gulf and Speed

An honest look at what a server in Germany means for visitors in Jordan and the Gulf: what distance really adds, when it matters, how caching and a CDN reduce it, and how to measure it yourself.

Ready to start, or have a question first?

We answer on WhatsApp Saturday to Thursday, 9:00 am – 9:00 pm Amman time (GMT+3)

WhatsApp