Java 类net.sf.ehcache.event.CacheEventListenerAdapter 实例源码
项目:offheapstore-benchmark
文件:BigMemoryGoStore.java
public BigMemoryGoStore() {
Configuration managerConfiguration = new Configuration()
.name("benchmark")
.cache(new CacheConfiguration()
.name("store")
.maxBytesLocalHeap(50, MemoryUnit.MEGABYTES)
.maxBytesLocalOffHeap(500, MemoryUnit.MEGABYTES)
.eternal(true)
);
cacheManager = CacheManager.create(managerConfiguration);
cache = cacheManager.getCache("store");
// get notified when cache is not big enough
CacheEventListener evictionListener = new CacheEventListenerAdapter() {
@Override
public void notifyElementEvicted(Ehcache ehcache, Element element) {
cacheFull = true;
}
};
cache.getCacheEventNotificationService().registerListener(evictionListener);
}