知识卡片
写穿不自动原子一致
写穿希望写入同步到缓存及持久存储后才确认,增加写等待。原书“先数据库成功再cache.set”是两个操作,缓存失败或并发覆盖仍会出现旧值;顺序执行不能证明两处原子更新或所有读取永远最新。
这张卡片看不懂?
这张卡片的反馈已满 10 条,暂时无法继续提交。
已有反馈 · 0 / 10 条
还没有人提交反馈。
在整书笔记中的位置
原书出处 · 1 处
- Distributed Caching · 查看原书依据
Write-through cache is a caching strategy that simultaneously writes data to the cache and the main memory. This ensures that the cache and main memory are always consistent. In this mechanism, the application updates the primary database, the data is then immediately written to the cache.
参考来源
- 位置:《Building Distributed Systems Designing scalable architectures with microservices, event-driven patterns, and robust deployment…》第11章《Distributed Caching》(来源项目book-sources;源文件:extracted/Building Distributed Systems Designing scalable architectures with microservices, event-driven patterns, and robust deployment…/_epub-src/OPS/ch11.xhtml)
- 结论依据:原文给出本卡对应定义或示例;写穿希望写入同步到缓存及持久存储后才确认,增加写等待。 对原文省略和过度承诺的限定是本卡显式纠正,不能反过来当作原书已证明。
- 原始内容:Write-through cache is a caching strategy that simultaneously writes data to the cache and the main memory. This ensures that the cache and main memory are always consistent. In this mechanism, the application updates the primary database, the data is then immediately written to the cache.