HomeChallengesRepsProblemsLeaderboardTake a challenge

Half the pods show the old price

A bundle is repriced and, for ten minutes, the price depends on which pod you ask. Each pod caches in its own memory and nothing tells it to stop. Cache in two levels, and let the event drop the stale copy.

Intermediate25 min on the clock6 graded checks · 100 pointsWorks on One Server

AssumesAsking Catalogue on every orderThe local copy and its BundleRepriced consumer are built there. This stage puts a cache in front of that copy and uses the same event to clear it.

Graded by reading your code against the checklist below.

What you build

  • Register a two-level cache with Redis behind it
  • Keep each pod’s memory copy short-lived
  • Read through the cache with GetOrCreateAsync
  • Remove the cached bundle when it is repriced
  • Remove it after the write, not before
  • Never cache a bundle that was not found

Done means

A two-level cache with a short local lifetime, read-through, invalidated by the event after the write, and no cached misses.

How it is graded

Published in full, before you start — every point is one of these and there is nothing else.

  1. A two-level cache with Redis behind it+20A cache every replica agrees on
  2. Each pod’s copy is short-lived+15A cache every replica agrees on
  3. Reads go through GetOrCreateAsync+25A cache every replica agrees on
  4. A repricing removes the cached bundle+15A cache every replica agrees on
  5. The write comes before the removal+10A cache every replica agrees on
  6. "Not found" is never cached+15A cache every replica agrees on

What it teaches

A cache every replica agrees onintermediate

A cache in each process’s memory cannot be cleared by the others, so a shared cache needs a signal that a copy is wrong — and a short, deliberate window in which a stale copy is allowed.

The rest of Works on One Server