Explore Library
System Design & ArchitectureCaching Strategies

91 items

1

Redis Cache-Aside Serialization Bug

Code Quiz
2

Redis Distributed Cache Consistency

Quiz
3

Cache-Aside Write Invalidation Bug

Code Quiz
4

What Caching Is & When to Use It

Slides / Video
5

Cache Invalidation on Update

Code Quiz
6

In-Memory vs Distributed Cache

Quiz
7

Cache TTL Expiry Bug

Code Quiz
8

Cache Hits, Misses & TTL Basics

Quiz
9

Redis Fundamentals for Caching

Slides / Video
10

Redis Fundamentals for Caching

Flashcard
11

Caching Plus Database Scaling

Slides / Video
12

Caching and Database Scaling

Flashcard
13

Cache Hit Ratio Formula Bug

Code Quiz
14

Cache Warming and Preloading

Slides / Video
15

Cache Consistency and Staleness Trade-offs

Slides / Video
16

Write-Through Caching

Quiz
17

Read-Through Caching

Quiz
18

Cache Sizing Trade-off

Quiz
19

Cache-Aside Pattern Basics

Quiz
20

LRU Eviction Policy

Quiz
21

Cache Hit Ratio

Quiz
22

Write-Back Caching Trade-off

Quiz
23

Hot Key Problem

Quiz
24

Multi-Level Caching

Quiz
25

Cache Penetration

Quiz
26

Cache Warming

Quiz
27

Redis vs Memcached

Quiz
28

HTTP ETag Header

Quiz
29

Consistency vs Staleness

Quiz
30

Caching Location Types

Quiz
31

Cache Avalanche

Quiz
32

Cache Stampede Problem

Quiz
33

Cache Invalidation Goal

Quiz
34

TTL and Expiration

Quiz
35

Write-Around Caching

Quiz
36

Cache Penetration, Breakdown, and Avalanche

Slides / Video
37

Cache Stampede and Mitigation

Slides / Video
38

Distributed Caching and Cache Partitioning

Slides / Video
39

In-Memory Caching: Redis vs Memcached

Slides / Video
40

CDN and Edge Caching

Slides / Video
41

Client-Side and Browser Caching

Slides / Video
42

Cache Penetration Guard

Code Quiz
43

Distributed Cache Coherence

Code Quiz
44

Consistent Hashing Ring

Code Quiz
45

CDN Cache-Control Header

Code Quiz
46

Stampede Lock Guard

Code Quiz
47

Invalidate On Update

Code Quiz
48

TTL Expiration Check

Code Quiz
49

FIFO Eviction Order

Code Quiz
50

LFU Frequency Counter

Code Quiz
51

LRU Recency Update

Code Quiz
52

Write-Around Pattern

Code Quiz
53

Write-Back Flush

Code Quiz
54

Write-Through Ordering

Code Quiz
55

Read-Through Cache Loader

Code Quiz
56

Local vs Remote Cache Sizing

Code Quiz
57

Cache-Aside Lazy Loading

Code Quiz
58

Avalanche Staggered Expiry

Code Quiz
59

Cache Invalidation Strategies

Slides / Video
60

TTL and Cache Expiration Strategies

Slides / Video
61

Cache Eviction Policies: LRU, LFU, FIFO

Slides / Video
62

Multi-Level Caching

Flashcard
63

Client-Side / Browser Caching

Flashcard
64

Cache Replication & HA

Flashcard
65

Distributed Caching

Flashcard
66

Cache Hit Ratio

Flashcard
67

Cache Warming / Preloading

Flashcard
68

In-Memory Local Caching

Flashcard
69

Cache Penetration

Flashcard
70

Cache Sizing and Memory

Flashcard
71

TTL and Expiration

Flashcard
72

Cache Invalidation Strategies

Flashcard
73

CDN / Edge Caching

Flashcard
74

Write-Around Cache

Flashcard
75

Write-Through Cache

Flashcard
76

Cache-Aside (Lazy Loading)

Flashcard
77

Write vs Read Optimization Trade-offs

Flashcard
78

Hot Keys and Load Distribution

Flashcard
79

Cache Avalanche

Flashcard
80

Cache Stampede

Flashcard
81

Write-Back (Write-Behind)

Flashcard
82

Cache Eviction Policies

Flashcard
83

Read-Through Cache

Flashcard
84

Cache Consistency

Flashcard
85

Write-Around Caching Pattern

Slides / Video
86

Write-Back (Write-Behind) Caching Pattern

Slides / Video
87

Write-Through Caching Pattern

Slides / Video
88

Read-Through Caching Pattern

Slides / Video
89

Cache-Aside (Lazy Loading) Pattern

Slides / Video
90

Cache Hit, Miss, and Hit Ratio

Slides / Video
91

What Caching Is and Why It Helps

Slides / Video
Code Quiz

Cache-Aside Write Invalidation Bug

Spot the cache invalidation ordering bug in a cache-aside write path.

Codejavascript
const cache = new RedisClient();
const db = new Database();

async function getUser(id) {
  const key = `user:${id}`;
  const cached = await cache.get(key);
  if (cached) return JSON.parse(cached);

  const user = await db.query('SELECT * FROM users WHERE id = ?', [id]);
  await cache.set(key, JSON.stringify(user), 'EX', 3600);
  return user;
}

async function updateUser(id, data) {
  const key = `user:${id}`;
  // update cache first for freshness, then persist
  await cache.set(key, JSON.stringify(data), 'EX', 3600);
  await db.query('UPDATE users SET ... WHERE id = ?', [id]);
}

What is the caching bug in the updateUser write path?