Managed Redis · 30 November 2026

Cluster-mode Redis and the read that returns nothing

A cache that works on your own Redis can quietly stop working on a managed, cluster-mode service. No error, no warning, just a miss on every request. This is the bug I shipped, and the check that would have caught it.

By Shane Rounce · 2 minute read

What happened

Ace Redis Cache can keep parts of a cached page live. Each live block has its own small copy in Redis, and the page is put together from those copies before WordPress loads. To fetch them I used one MGET, which asks Redis for several keys in a single command.

On a development server with a local Redis that worked. On a cluster-mode service every such page reported a miss and went to WordPress. Nothing was logged.

Why

A Redis cluster splits its keys across slots, and a command that touches several keys only works when they all live in the same slot. Mine never did. The server refused the command with a CROSSSLOT error.

The PHP Redis extension did not raise that as an exception. It returned false. My code read false as "nothing stored" and carried on, which is exactly what a cache should do when a key is missing, and exactly wrong here.

The fix

Ask for the keys one at a time, but send them together:

$pipe = $redis->pipeline();
foreach ($keys as $key) {
    $pipe->get($key);
}
$values = $pipe->exec();

Each GET touches one key, so no slot rule is broken, and the pipeline still makes one round trip. On the live service, five keys came back in about two milliseconds.

Deletes need the same care. A DEL with several keys fails the same way, so those go one key per command too.

What I check now

  • Any command that names more than one key is a cluster risk: MGET, MSET, multi-key DEL, SUNION and friends.
  • A false from a read is not the same as a miss. If you cannot tell them apart, log it once.
  • Test against a cluster before you trust it. A single local Redis cannot show this bug.
  • Look at the hit rate after a move, not just the error log. A cache that fails quietly looks healthy until you count.

Ace Redis Cache has read and deleted this way since version 0.9.5. If you are moving a WordPress site to a managed Redis service, the changelog has the detail.

All notes Get the latest release