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); }