Skip to content
HyperDAF editorialCaching

Object Caching in WordPress: Redis vs Memcached

Object caching WordPress guide: how Redis and Memcached store database results in fast memory, when your site truly needs them, and setup done correctly.

CachingEditor-curated guide
13 min9 sectionsIntermediate
Before you beginWhat this guide gives you
9Focused sections13Minutes to finishIntermediateExperience level86Article views
Start reading
Table of contents9

My client’s product page took eleven seconds to load. Eleven. He had already done everything the speed guides told him — caching plugin, smaller images, a fast theme. His hosting dashboard said everything was “optimised,” and the page still moved like it was wading through wet cement. That evening I sat with his server logs and found the real culprit: every single page load asked the database the same 180 questions, over and over, and the database answered every one from scratch.

I am Tom Baker, and I have set up persistent object caching on dozens of WordPress sites over the last decade. That eleven-second page now loads in under two. Here is the fear I hear from every site owner: “Caching sounds like server wizardry — if I touch it, I will break the site.” I get it. But in this guide I will show you the exact ritual I follow on every site: check what your host offers, switch it on safely, and prove with real timing numbers that it is working. No guessing.

If you run a WordPress site that talks to the database a lot — a WooCommerce store, a membership site, a busy blog — this is the one speed skill nobody taught you, and it is simpler than it sounds. Let me show you.

Abstract 3D illustration of layered memory cache blocks stacked like a pyramid on a deep navy background with green geometric shapes.

One honest warning: object caching is not a magic wand. It will not fix a bloated theme or shrink your 5MB hero image. What it does brilliantly is kill repeated database work — and everything I promise here is verifiable: you will time your site before and after, and see the difference in your own numbers.

Here is what this guide covers:

  • What Object Caching Actually Does (in Plain Words)
  • When It Helps — And When It Honestly Will Not
  • Step 1: Check What Your Host Offers
  • Step 2: Switch It On the Right Way
  • Step 3: Prove It Is Actually Working
  • Step 4: When It Breaks Things — The Flush and Fix
  • Redis or Memcached: What Each One Really Does
  • Frequently Asked Questions
  • Final Thoughts

Ready? Let’s get started.

What Object Caching Actually Does (in Plain Words)

Imagine you run a small shop, and every customer asks you the same question: “What time do you close?” Now imagine that instead of remembering the answer, you walk to the back office, open a filing cabinet, find the folder, read the answer, walk back, and tell the customer — every single time, for every customer, all day. That is what WordPress does without object caching.

Every time someone loads a page, WordPress asks the database the same questions again: the site name, the menu items, the post’s categories. On a simple page that might be 30 questions; on a WooCommerce product page, 150 to 300 — answered from scratch, every single load.

Here is the deal: object caching is a memory notepad between WordPress and the database. The first visitor’s answer gets written on the notepad; the next hundred visitors read it straight from there — no filing-cabinet trip. The notepad lives in fast server memory (RAM), so reading it takes almost no time.

One important distinction: WordPress already has a small built-in notepad, but it is thrown away the moment each page finishes loading. What we are setting up is persistent object caching — the notepad survives between page loads, stored in Redis or Memcached memory your host provides.

I learned how big this difference is the hard way. Years ago I spent a weekend “optimising” a membership site — new caching plugin, image compression, the works — and shaved off maybe half a second. Then I enabled persistent object caching on a Monday morning. The database query count on the members dashboard dropped from 214 to 11. That was the day object caching became step one on every serious site I touch.

When It Helps — And When It Honestly Will Not

Let me be straight with you, because the honest line matters more than the hype. Object caching helps enormously when your slowness comes from repeated database work. It helps almost not at all when your slowness comes from somewhere else.

It helps most on WooCommerce stores, membership sites, and busy blogs — anywhere pages are dynamic and different per visitor. Page caching cannot help those pages, so object caching is often the only big win left. That is why so many “I did everything and it’s still slow” stories end here.

It will not help when your theme is bloated, your images are enormous, or your hosting is underpowered. It cannot shrink a 4MB hero image or fix a high [TTFB](https://hyperdaf.com/how-to-reduce-ttfb-on-wordpress-server-response-fixes/) caused by an overloaded server. Fix images and theme first — you will get far more from this ritual on a sound foundation.

Here is the thirty-second test: install the free Query Monitor plugin, load your slowest page, and check the query count. Under 40: your database is fine, look elsewhere. Over 100: object caching will almost certainly help, and Step 3 will prove it. That client page? 182 queries. Textbook case.

Step 1: Check What Your Host Offers

Before you touch a single setting, answer one question: does your hosting give you Redis or Memcached? Most managed WordPress hosts offer one of them, often as a single toggle in the hosting panel. Budget shared hosts often offer neither — fine, but then this ritual is not for your current plan.

Log in to your hosting panel and search for “Redis” or “Memcached,” or look under Cache, Performance, or Advanced. Many hosts offer a simple “Object Cache” or “Redis Cache” toggle — switch it on and the host does the hard server-side part for you.

No toggle anywhere? Open a support ticket with this exact sentence: “Do you offer Redis or Memcached for persistent object caching on my plan, and how do I enable it?” Good hosts answer within the hour. If the answer is “we don’t offer it,” count that against the host when your contract renews.

Note which backend your host provides. You do not choose between them — you use whichever your host gives you. The connection step is nearly identical either way.

Step 2: Switch It On the Right Way

This is the part that sounds scary and is not. Connecting WordPress to Redis or Memcached uses a well-known pattern called the drop-in file — just three moves, each with its own verification.

Most hosts do this entire step for you. If your panel had a toggle in Step 1 and you switched it on, check whether `wp-content/object-cache.php` already exists. If it does, the host installed the drop-in — skip to Step 3. If not, here is the manual ritual.

Move 1: Tell WordPress caching is allowed. Open your `wp-config.php` file (it sits next to your `wp-content` folder) and add this line, above the line that says “That’s all, stop editing”:

`define( ‘WP_CACHE’, true );`

That line is a permission slip — nothing changes yet. Verification: reload any page; nothing should look different. If something looks off, restore your backup of `wp-config.php` (likely a broken quote mark) and try again.

Move 2: Install the drop-in file. The file `wp-content/object-cache.php` is a small PHP file that teaches WordPress how to talk to Redis or Memcached. Get the correct one from your host’s documentation — search their help centre for “object-cache.php” and use their recommended file or plugin. Upload it into your `wp-content` folder (not into `plugins`), and you are connected.

In plain words: every time WordPress wants to remember or recall an answer, this file intercepts the request and stores it in your host’s Redis or Memcached memory. It must sit exactly at `wp-content/object-cache.php` — one folder off and WordPress ignores it.

Move 3: Flush once, then browse. After the file is in place, flush any stale cache so you start clean — many hosts add a “Flush Object Cache” button in the admin bar or panel. Then visit your homepage and two inner pages as a logged-out visitor. They should load normally. If anything looks broken, do not panic — Step 4 covers it.

You do not need SSH or server configuration tweaks. Your host manages the memory server; your job is only the three moves above.

Abstract 3D illustration of a database cylinder with a shortcut arrow bypassing repeated queries on a deep navy background with green geometric shapes.

Step 3: Prove It Is Actually Working

Here is where this guide differs from every vague “just enable it” tutorial. We do not trust feelings. We measure before, change one thing, measure after. I run this ritual on every single site.

The before measurement. Open your slowest page in a private browser window and time it three times with GTmetrix or your browser’s developer tools network tab. Note the fully-loaded time plus — with Query Monitor active — the database query count and query time. Average the three runs. That is your “before.”

The after measurement. Enable the drop-in, flush the object cache once, then load the same page twice — the first load fills the notepad, the second reads from it — and time it three more times. Write down the same numbers.

Reading the result. Healthy looks like this: query count drops 70–90%, database query time drops sharply, and fully-loaded time drops noticeably — often 1 to 4 seconds on the worst pages. On that eleven-second product page, queries went from 182 to 14 and load time to under 2 seconds. If your numbers barely move, your bottleneck lives elsewhere (images, theme, server) — and now you know that for certain instead of guessing.

Step 4: When It Breaks Things — The Flush and Fix

The first time object caching bit me, a client’s site showed week-old prices after a sale ended. The fix took ninety seconds: I flushed the object cache, fresh prices appeared instantly, and I learned the golden rule below.

Stale data is the number one symptom. Old prices, old menu items, changes not appearing — the cache is holding yesterday’s answers. This is normal behaviour, not a disaster; well-built drop-ins clear entries automatically on update, but no system is perfect.

The flush procedure. Flushing wipes the notepad clean so every answer gets re-fetched fresh. Use your host’s “Flush Object Cache” button, or the flush option in whatever plugin manages your drop-in. Do this first whenever something looks stale — in nine cases out of ten, the problem vanishes. And to clear every type of cache on your site in one go, [this complete guide to clearing WordPress cache](https://hyperdaf.com/how-to-clear-wordpress-cache-every-method-that-works/) covers every method that works.

The disable procedure. If flushing does not fix it, disable the cache in thirty seconds: rename `wp-content/object-cache.php` to `wp-content/object-cache.php.off` via your hosting file manager or FTP. WordPress instantly falls back to normal. Nothing is lost. Re-enable by renaming the file back.

The “was it the cache?” test. Whenever something weird happens: flush the cache — problem gone? It was stale cache. Still there? Rename the drop-in to `.off` and check again. If the problem disappears, the drop-in is the cause — tell your host’s support exactly that. This two-minute test has saved me hours of wrong-direction debugging.

Abstract 3D illustration of glowing server memory chips in a row on a deep navy background with green geometric shapes.

Redis or Memcached: What Each One Really Does

You might wonder what Redis and Memcached actually are, and whether you should care which one your host gave you. Short answer: barely. But plain-words understanding beats blind compliance.

Both are persistent key-value stores — fancy words for a very fast notepad. WordPress says “remember this answer under label X,” the store files it in server memory; WordPress asks for label X, the store hands it back in microseconds. Server RAM reads roughly a hundred times faster than a database on disk — that gap is the entire game.

The actual difference, in plain words: Memcached is the simpler, older notepad — one job, done well, easy to run across multiple servers. Redis is the newer, more capable notepad — it also stores complex structures, handy for extra jobs like fragment caching.

The practical framing: you do not pick between them like products on a shelf. Your host picks, you connect. Redis? Connect the Redis drop-in. Memcached? The Memcached drop-in. Both? Ask support which they recommend. No wrong answer — only a connected one.

One honest note: on a typical single-server site, you will not feel a meaningful difference between the two. The giant leap is from no persistent cache to having one; the gap between Redis and Memcached is a rounding error. Anyone telling you otherwise is selling something.

For the bigger picture: object caching is one layer of a complete strategy, alongside page caching and [browser caching](https://hyperdaf.com/browser-caching-for-wordpress-the-complete-setup-guide/) — each solves a different problem, and they stack. If caching sometimes seems to break things, [this explainer on why caching breaks WordPress sites](https://hyperdaf.com/why-caching-breaks-your-wordpress-site-and-the-fix/) connects the layers.

Abstract 3D illustration of two parallel lanes merging into one fast lane on a deep navy background with green geometric shapes.

Frequently Asked Questions

Will object caching break my site? It can cause stale content, but rarely breaks a site outright — and the fix is always the same thirty-second procedure: flush the cache, or rename `object-cache.php` to `.off`. Follow the before-and-after ritual and you will catch any issue within minutes.

Do I need Redis or Memcached if I already have a caching plugin? Yes — they solve different problems. Your caching plugin stores finished HTML pages; object caching stores the database answers used to build them. They stack, and dynamic pages caching plugins cannot help (carts, dashboards, logged-in content) are exactly where object caching shines.

My host does not offer Redis or Memcached. What now? Then this ritual is not available on your plan, and no plugin truly replaces a real memory store. Ask about a higher plan, consider a better host at renewal, or focus on what you control — images, theme weight, page caching. Skip “object cache” plugins that just write files to disk.

How much memory does the object cache need? Surprisingly little — a few dozen megabytes handles thousands of answers, and your host manages the allocation. A healthy cache shows a hit rate above 90% in your host’s statistics. Persistently low? That is a support ticket to your host, not a setting for you.

Can I use both Redis and Memcached at the same time? No practical reason to. WordPress uses one object cache drop-in at a time — pick your host’s recommendation, verify it with the timing ritual, and move on.

Final Thoughts

That eleven-second product page still sticks in my mind — not the numbers, but the client’s face when it loaded in under two seconds. He had spent months assuming his site was just “slow,” a permanent condition. It was not. It was 182 repeated database questions, and a notepad fixed it.

You now know the whole skill: what the notepad does, when it helps, the three-move connection ritual, the before-and-after proof, and the thirty-second escape hatch. That is genuinely everything — the same ritual I run on serious client sites.

Here is my honest line: object caching will not fix every slow site. But on the right site, it is the biggest win you have not tried yet — and now you can measure it yourself instead of taking anyone’s word for it. Go run the ritual.

Did your numbers drop? Hit a snag with your host? Leave a comment below — I read every one. Related reading: shared versus managed WordPress hosting, is your WordPress theme slowing you down, plugin mistakes that slow WordPress, the WordPress speed battleground, and how to switch WordPress themes safely.

Written by

Tom Baker

Tom has maintained WordPress sites for clients for over 11 years. He writes about migrations, maintenance workflows, and the unglamorous decisions that keep sites running reliably.

6 published articles
View all articles

Related articles

View all articles

1 comment

Join the discussion

Your email address will not be published. Required fields are marked *

Keep comments relevant and respectful.