← 返回刚才阅读的位置

知识卡片

普通读书笔记卡 · 2313.e.5.f.10.b.3.e.1.a.1.b.1.c

空值缓存防重复穿透

理解等级:中级

不存在的键每次都未命中并查询数据库,会产生缓存穿透。以短TTL缓存不存在结果可减少重复查询;数据新建后可能暂时被旧空值遮住,因此要限制期限或及时失效,并防大量随机键占满缓存。

这张卡片看不懂?

已有反馈 · 0 条

    还没有人提交反馈。

    在整书笔记中的位置

    原书出处 · 1 处

    • Distributed Caching · 查看原书依据

      The solution is to store negative results. Just as a store might put up a Not Available sign for frequently requested but unavailable items, we can cache null results with a shorter TTL.

    参考来源

    - 位置:《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) - 结论依据:原文的机制或对比支持以下核心判断:不存在的键每次都未命中并查询数据库,会产生缓存穿透。 本卡将相邻说明中的适用限制保留为解释。 - 原始内容:The solution is to store negative results. Just as a store might put up a Not Available sign for frequently requested but unavailable items, we can cache null results with a shorter TTL.