Learn/Glossary/Cache-Aside Pattern
Performance

Cache-Aside Pattern

The application handles database caching: check cache first, fetch from database on miss, and write back to the cache.

Diagram

  App.getProduct(id) ──▶ [Check Redis] ── HIT ──▶ Return
                              │
                            MISS
                              ▼
                      [Read Postgres] ──▶ [Save to Redis] ──▶ Return

In Depth

Cache-Aside (or Lazy Loading) is a software pattern where the application code explicitly orchestrates reading from and writing to both the cache and the database.

Related Terms