System Design

Cache Patterns: Cache-Aside vs Write-Behind

System Design diagram · made in Skemio

Architecture diagram comparing Cache-Aside lazy loading with Write-Behind asynchronous batch flushing from Redis to PostgreSQL.
Architecture diagram comparing Cache-Aside lazy loading with Write-Behind asynchronous batch flushing from Redis to PostgreSQL.

What it shows

  • Cache-Aside loads data lazily on miss; simple but vulnerable to stale data.
  • Write-Through updates cache and database synchronously for consistency.
  • Write-Behind buffers writes in cache and flushes asynchronously in batches.

The takeaway

Use Cache-Aside for read-heavy workloads, and Write-Behind when write throughput exceeds database capacity.

More system design diagrams