这里是 Java 8。当记录被逐出缓存时,是否有任何方法可以通知Caffeine缓存框架(或任何其他 JSR-107 兼容框架)?
也许某种EvictionEventListener
或什么?
public class MyEvictionListener implements EvictionEventListener<String> {
@Override
public void onEvictionEvent(EvictionEvent eviction, String key) {
// Now I have access to the String "key" that was evicted and
// some information surrounding the eviction and I can do
// whatever I want with this information....
}
}
咖啡因、番石榴、Hazelcast(基本上是“ JVM 缓存区”)等中是否有类似的东西?