Skip to content
StackDecode
System Design
7. Caching ArchitectureAnimated

Write-Around Cache

Write to the database and skip the cache.

The idea

Writes go straight to the database. The cache fills only on reads.

Watch it work

Press play, pause, or step through. Some animations have settings you can change.

RequestL1 in-processL2 RedisDatabase
  • client
  • gateway / proxy
  • service
  • cache
  • data store
  • queue / stream

Check the in-process cache: nanoseconds.

step:
1/4
at:
Request
1/10

The green dot is a request moving through the system.

Step by step

  1. 1Write to the database
  2. 2Cache is untouched
  3. 3Next read misses
  4. 4The read populates the cache

Where it is used

Data that is written but rarely read.

Watch out for

The first read after a write is slow.

Related