在这篇关于实现 Caffeine 异步缓存的博客文章之后,我们想从缓存中获取统计数据。
我们使用2.7.0
的是咖啡因版本
但是,似乎AsyncCache
无法访问其统计信息:
private AsyncCache<String, Cat> asyncCache = Caffeine.newBuilder()
.expireAfterWrite(1, TimeUnit.HOURS)
.recordStats()
.maximumSize(100)
.buildAsync();
private Cache<String, Cat> cache = Caffeine.newBuilder()
.expireAfterWrite(1, TimeUnit.HOURS)
.maximumSize(100)
.recordStats()
.build();
....
cache.stats(); // this is possible
asyncCache.stats(); // no such method in asyncCache
另外,在查看AsyncCache的源代码并将其与Cache类进行比较时,async 类中没有任何stats()
方法。
这有什么原因吗?