Skip to content
We areTOP 1%

What are the cache-aside, write-through and write-back caching strategies?

MediumConceptCaching
Track your progress
First attempt
Re-solve after a few days
Final pass before interviews

Answer

These strategies define when data enters the cache and when writes reach the database, trading freshness, write latency and durability.

  • Cache-aside (lazy loading): the application checks the cache and, on a miss, reads the database and fills the cache. On a write, it updates the database and deletes the cache entry. This is the most common pattern; only requested data is cached, but each miss is slower.
  • Write-through: every write goes to the cache and the database synchronously, so the cache stays fresh at the cost of slower writes and caching data that may never be read.
  • Write-back (write-behind): writes go to the cache and are flushed to the database asynchronously; writes are fast, but data is lost if the cache fails before flushing.
  • Write-around: writes bypass the cache entirely, suiting data that is rarely re-read.

More in Caching

Sign in to track your progress

Your checkboxes, streak and activity heatmap are saved to your account and sync across devices. It is free.
Sign in with email

New here? Create an account