參考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