【问题标题】:[Guava caching]: Ensuring understanding of expireAfterAccess/Write[Guava 缓存]:确保对 expireAfterAccess/Write 的理解
【发布时间】:2021-06-28 18:16:02
【问题描述】:

From the CacheBuilder documentation in Guava Common:

如果请求 expireAfterWrite 或 expireAfterAccess 条目可能是 在每次缓存修改、偶尔缓存访问或 在调用 Cache.cleanUp() 时。过期的条目可能会被计数 Cache.size(),但对读写操作永远不可见。

我只是想确认这意味着,即使我们使用expireAfterWrite / expireAfterAccess,缓存仍然需要被客户端代码以某种方式访问​​,以便抛出元素出它,即没有与在后台清理它的缓存关联的守护线程。

【问题讨论】:

  • 正确。使用守护线程是后续库 Caffeine 的 optional feature
  • 非常感谢!关闭这个。

标签: caching guava


【解决方案1】:

@Ben Manes 在 cmets 中回答。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2014-08-10
    • 2012-01-28
    • 2015-11-11
    • 1970-01-01
    • 2014-10-26
    • 1970-01-01
    相关资源
    最近更新 更多