cache invalidation

1
2
3
4
5
6
7
8
9
10
11
// read data
val = cache.get(key)
if val == nil {
val = db.get(key)
cache.put(key, val)
}
return val
// write data
db.put(key, val)
cache.put(key, val)

这会造成dual write conflict

如果需要的只是eventaul consistency,那么通过dbus来进行cache invalidation是最有效的

https://martinfowler.com/bliki/TwoHardThings.html

Share Comments