Skip to content
StackDecode
System Design
7. Caching ArchitectureAnimated

First-In-First-Out (FIFO)

Evict the oldest inserted entry.

The idea

Simple queue-based eviction that ignores how often items are used.

Watch it work

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

request streamABFBFADADADFAADAACBDAFcache (4 slots)Ain at 1MISS A is fetched from the databasehit rate 0% (0 of 1)
  • hit
  • current request

A is missing: fetch it from the database and store it.

step:
1
hits:
0
1/22

Eviction policy: oldest inserted.

Step by step

  1. 1Insert at the tail
  2. 2When full remove the head
  3. 3Hits do not change order
  4. 4Oldest entries leave first

Where it is used

Simple or small caches.

Watch out for

May evict hot items.

Related