Hit vs. miss
Read a cold key and pay the ~106ms database round-trip. Read it again within its TTL and the same request returns in ~5ms.
Run it in the simulatorA cache-aside simulator you can break. Send reads and writes at a cache and a database, and watch hits, misses, invalidation, TTL expiry and LRU eviction happen one step at a time.
Nothing has run yet. Start with a cold read and a warm read of the same key.
Writes and deletes go to the database first, then remove the cached copy.
Every step is logged here. Click an event to see the state at that moment.
Scenarios
Each one starts from an empty cache and plays out in the simulator above.
Read a cold key and pay the ~106ms database round-trip. Read it again within its TTL and the same request returns in ~5ms.
Run it in the simulatorWrites go to the database first, then delete the cached copy, so the next read fetches the fresh value.
Run it in the simulatorFour slots, six records. Read a fifth key and the least recently used entry, always the bottom slot, is pushed out.
Run it in the simulatorEvery entry counts down from 60s. Skip the clock ahead, the entry expires, and the next read misses.
Run it in the simulatorUnder the hood
The simulation follows the same rules a production cache-aside deployment would — it just runs where you can see every move it makes.
Hits, misses, eviction, expiry, and invalidation are reproduced faithfully in the browser.
Every operation is planned as a pure sequence of steps before it animates — the same state always produces the same run.
Each event stores the full cache, database, and metrics state, so any moment can be re-opened and inspected after the fact.
Cache ~1ms, database ~90ms — explanatory constants, not benchmarks, chosen so the cost of a miss is impossible to ignore.
One client, one cache node, one database — the exact topology most systems start with. Replication and multi-node consistency are the natural next chapter.
Built by Abhishek Suman
I build backend services, and tools like this to show how they behave.