liveBook · Manning

Write-behind caching

As explained in Advanced Algorithms and Data Structures

Write-behind is a storage policy that writes changes to a cache immediately and propagates them to backing storage later under specified conditions.

Write-behind caching stores every change in the cache immediately, then propagates it to backing storage only at specified times or when conditions occur, such as a read. The cache stays fresh while the database may remain stale. section 7.6

Choose this policy when the performance benefits justify delayed persistence:

  • Reduce write latency and database load by avoiding an immediate backing-store update. section 7.6
  • Accept that backing storage can be stale and that changes may be lost if an entry is never written back. section 7.6
  • Contrast it with write-through, which updates the cache and backing storage together and therefore trades speed for lower loss risk. section 7.6

Updating on a later read

A cache placed before a database can accept a changed value immediately and update the database only when another client requests that entry. If nobody reads it afterward, the database may never receive the change. section 7.6

How Advanced Algorithms and Data Structures covers it

How deep it goes
Explains immediate cache writes, conditional propagation, freshness, and loss risks, but does not specify implementation mechanics.
Examples
Illustrates updating the database when another client requests an entry or when a later read triggers write-back.
What it assumes
Assumes a cache and backing store such as a database, while defining how their writes are coordinated.
What you can do after
Apply it as a cache policy while balancing write latency, database load, stale storage, and possible data loss.
How it connects
Connects write-behind to caching, backing storage, write-through, write-around, read-ahead, refresh-ahead, and eviction policies.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Advanced Algorithms and Data Structures. The section links point to the parts of the book it draws on.