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

最后編輯于
?著作權歸作者所有,轉載或內容合作請聯系作者
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發布,文章內容僅代表作者本人觀點,簡書系信息發布平臺,僅提供信息存儲服務。

推薦閱讀更多精彩內容