Skip to main content
InterviewHubPRO
Section Overview
Q4

Question 4 of 50

Part 1: Basic & Foundational Concepts (Junior / Entry-Level)

8%
Redis & Caching (50 Qs)•Part 1: Basic & Foundational Concepts (Junior / Entry-Level)

What are the common Caching Patterns: Cache-Aside vs Write-Through vs Write-Behind?

junior LevelMost AskedSystem Design

In Simple Words:

  • Cache-Aside (Lazy Loading - Most Common):
    1. Application checks Redis. If hit -> return data.
    2. If miss -> read from PostgreSQL/MySQL, store in Redis with TTL, return data.
  • Write-Through: Application writes data to the cache, and the cache synchronously writes to the database before acknowledging success. High consistency, higher write latency.
  • Write-Behind (Write-Back): Application writes data only to Redis. An asynchronous worker batches writes and commits them to the database later. Blazing fast, but risk of data loss if Redis crashes before flushing.