Card 1 of 5
Where does the copy of product 8812 live?
The shop caches popular products to reduce database reads. A shared cache hit crosses the network. A local hit avoids that trip, but each process now holds a copy that can become stale.
Emma opens the kettle page. Where is the copy of product 8812? Emma's phone page service read copy cache copy of 8812 (where?) product DB slow, busy Cache-aside: the page service owns the miss and refill path. source read on a miss
How each product handles it
Redis: shared server with optional tracked client copies page service 1 trip Redis server copy of 8812 local copy of 8812 "8812 changed, drop yours" Tracked copies: discard if invalidation delivery is lost.
Watch out
But Your client library has to support this feature, and not all of them do.
If the connection that carries the 'it changed' messages drops, throw away the whole local copy, because you can no longer trust it.
RedisRedis is a separate server, so each read is one trip.
- Redis can also tell the page service: keep your own copy of 8812, and I'll message you when it changes.
- That feature is called client-side caching.
- With it, most reads make no trip at all.
Dragonfly: Redis protocol, command-specific compatibility page service 1 trip Dragonfly server copy of 8812 local copy of 8812 "8812 changed" (basic mode) Basic tracking only; check client-mode compatibility.
Watch out
But These options concern broadcast/prefix invalidations and redirecting notifications to another connection. Check your client’s tracking mode and discard untrusted local copies after a notification connection failure.
DragonflyDragonfly accepts Redis clients for supported commands.
- Basic client tracking is available, but BCAST, PREFIX and REDIRECT are not supported in the current compatibility list.
Memcached: separate servers that know nothing of each other page service 1 trip memcached 1 8812 lives here memcached 2 the page service works out which server from the key your own local copy? No automatic invalidation of this local copy.
MemcachedMemcached is a group of separate servers that don't know about each other.
- The page service works out which server holds 8812 from the key, then makes one trip.
- If you want a local copy, you build it yourself.
- Memcached will never tell you when it goes stale.
Hazelcast: can live inside the page service itself page service (Java process) Hazelcast member copy of 8812 in the same memory 0 trips for this locally owned entry second member backup copy kept in sync Local ownership shown. Remote entries still require a trip.
Watch out
But A Near Cache copy can be up to 10 seconds old, because invalidations travel in batches. The docs call that eventually consistent.
A successful write does not mean every client has invalidated its old copy; do not use that path alone for strict revocation checks.
HazelcastHazelcast can embed a member in a Java application.
- A locally owned entry needs no network trip; other entries still go to their owner.
- An optional Near Cache serves local copies in supported clients, but change notifications take time to arrive, so it can briefly return an old value.
Aerospike: a separate cluster, index in memory, data on SSD page service 1 trip memory: where is 8812? SSD: the record itself Recent records may be read from memory buffers.
Watch out
But Aerospike can also keep records in memory. The storage you pick does not change the record and bin model. One network trip plus one SSD read is the usual cost of a read.
AerospikeAerospike stores records with typed bins.
- The illustrated storage mode keeps an index in DRAM and records on SSD; recent records may be read from memory buffers.
- Bins describe the record.
- Memory or SSD is where it sits.
Remember: Local hits avoid a network trip. They also introduce another copy whose freshness the application must account for.