Repaso
Español
System DesignIntermediateSD-05

Write-through caching means…

Options

  1. Writes go to the cache only and never reach the DB
  2. Every write updates the cache and the database together (Correct option)
  3. Writes skip the cache and go straight to the DB
  4. The cache is cleared on every write

Answer

Every write updates the cache and the database synchronously

Why

With write-through, every time data is saved, the app writes it to the cache AND the database together.

The cache is always up to date, so reads are fresh. The cost is slower writes (two places).

Write-back (write-behind) writes to the cache first and to the database later: faster, but data can be lost if the cache crashes.

Remember

Write-through = write to cache and DB together.

Key terms

Practice this question in Repaso