6

你们引入缓存中间件,会去解决数据库缓存双写一致性的问题吗

 2 years ago
source link: https://www.v2ex.com/t/781166
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

V2EX  ›  Java

你们引入缓存中间件,会去解决数据库缓存双写一致性的问题吗

  zhongpingjing · 5 分钟前 · 24 次点击

看了一篇博文了解了一些相关的内容,了解到引起不一致性的原因:
先删缓存,再更新 DB (这种策略应该没有人用?)
先更新 DB,再删缓存(这种发生不一致性的概率虽然可以忽略不计,但是是否需要去防止?)
先更新 DB,然后删除缓存失败(真的会发生删除缓存失败吗?网络原因?)
DB 主从复制的延迟造成不一致
。。。

解决这个双写一致性问题,需要双删和重试。感觉这种方式代价有点大啊。
在实际生产中,会这样去解决吗?有没有更好的办法?


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK