When a system writes data to a cache, it must at some point write the data to the backup store. The time to write this is controlled by what is called the writing policy.
There are two basic approaches to writing:
Writing: Writing is done synchronously in both the cache and the backup store.
Write-back (also called writing in the background): Initially, writing is done only in the cache. Writing in the backup store is deferred until the cache blocks containing the data are about to be changed / replaced with new contents.
A rewrite cache is more complex to implement since you should find the sites that were written and mark them as dirty so later write to the backup store. Data from these locations are written to the backup store only when they are expelled from the cache, an effect called lazy writing. For this reason, a read error in a rewriting cache (which requires one block to be replaced by another) often requires two memory accesses for the service: one to write the data replaces the cache memory to store, and then One to retrieve the necessary data.
Other policies may also trigger data rewriting. The client can bring many changes to the data in the cache and then explicitly notify the cache to write data.
No data is returned on writing operations, there are two approaches to not complying with writing situations:
Write assign (also called draw write) location data of the lost write is loaded into the cache, followed by a write operation. In this approach, writing errors are similar to reading errors.
Do not assign write (also called non-write to map or write around): the data of the failed write location is not loaded into the cache and written directly into the backup store. In this approach, only reads are cached.
Immediate writing and writing strategies can not use any of these miss-writing strategies, but they are usually paired like this:
Rewriting the cache uses write assigning, hoping that the following entries (or readings) are in the same place, which is now cached.
Writing cache uses no writing. Here, the following entries have no advantage as they have not yet been written directly to the carrier store.
Entities other than the cache may change the data in the backup store, in which case the copy in the cache may become obsolete or obsolete. Otherwise, when the client updates the data in the cache, copies of this data in other caches become obsolete. Communication protocols between cache managers that maintain coherent data are called consistency protocols.