Cache写机制分为write through和write back两种

参考http://en.wikipedia.org/wiki/Cache#Writing_Policies上的说明,Cache写机制分为write through和write back两种。

Write-through- Write is done synchronously both to the cache and to the backing store.

Write-back (or Write-behind) - Writing is done only to the cache. A modified cache block is written back to the store, just before it is replaced.

Write-through(直写模式)在数据更新时,同时写入缓存Cache和后端存储。此模式的优点是操作简单;缺点是因为数据修改需要同时写入存储,数据写入速度较慢。

Write-back(回写模式)在数据更新时只写入缓存Cache。只在数据被替换出缓存时,被修改的缓存数据才会被写到后端存储。此模式的优点是数据写入速度快,因为不需要写存储;缺点是一旦更新后的数据未被写入存储时出现系统掉电的情况,数据将无法找回。


http://witmax.cn/cache-writing-policies.html

你可能感兴趣的:(Cache写机制分为write through和write back两种)