Q10: What are cache-aside, write-through, and write-behind strategies?

Difficulty:MediumTopic:Caching

With cache-aside, the application checks the cache, reads from the database on a miss, and then populates the cache; it is simple but can serve stale data until invalidation or expiry. Write-through updates the cache and data store as part of the write path, improving cache freshness but adding latency and coordination. Write-behind updates the cache first and persists asynchronously, improving write latency but risking data loss unless the queue and persistence path are durable.

Key Takeaways
  • Cache-aside is common for read-heavy workloads.
  • Write-behind requires explicit durability and recovery guarantees.