系统设计 Cache invalidation

Write-around cache: This technique is similar to write through cache, but data is written directly to permanent storage, bypassing the cache. This can reduce the cache being flooded with write operations that will not subsequently be re-read, but has the disadvantage that a read request for recently written data will create a “cache miss” and must be read from slower back-end storage and experience higher latency.

请问,这个write-around cache, 如果我们直接绕过cache,把新的数据写到database,那么cache不是保存了旧的数据吗?一个read request怎么会产生cache miss? 还是说可以有个快速的操作(比 write to the cache 快)可以让cache 里面的数据invalid?

Write around的前提是Write miss

如果是Write hit, 我們有兩種方式 一種是Write through 一種是Write back
如果是Write miss, 我們有種兩方式 一種是Write around 一種是allocate on write

可以看我的部落格 https://www.jyt0532.com/2018/09/23/cache-mechanism/ 有我關於緩存的筆記以及整理:

好的。谢谢你的部落格。我看到的资料里面写的没有这么详细。我的理解,他们直接分成了Write through, write back, 以及write around. 我后来想了一下,感觉即使在write hit的情况下,我们依然可以选择write around,即不更新cache,直接写DB,或许设置TTL让cache里面的内容invalid,然后产生read-miss? 不过,如果是write hit,不更新cache的确是有consistency的问题。