Pattern 07 / CACHE

Cache-Aside (Lazy Loading)

Use this when avoiding repeated database reads for frequently requested data.

Pressure
Avoiding repeated database reads for frequently requested data
Mechanism
The app checks cache first, loads from the database on miss, then stores the result for later
Toll
First request is slow and cache invalidation must be handled carefully
Architecture plate07
Diagram for Cache-Aside (Lazy Loading)
Executive brief

Cache-Aside (Lazy Loading) fits when avoiding repeated database reads for frequently requested data. Mechanism: the app checks cache first, loads from the database on miss, then stores the result for later. Use it for default caching for mostly-read workloads where misses are acceptable. The toll: first request is slow and cache invalidation must be handled carefully.

Use when

Default caching for mostly-read workloads where misses are acceptable.

Example

User profile lookup cached after the first database read.

Review framing

Describe the pressure first, then the mechanism, then the cost. That keeps the design grounded.

Same pressure family

Caching Patterns

08Write-Through09Write-Behind (Write-Back)10Read-Through11Cache Stampede Prevention
โ† 0608 โ†’