@Override public boolean remove(Object key, Object value) { boolean removed = super.remove(key, value); if (removed && entryCountingEnable) { // Removed cacheContext.decreaseEntryCount(); } return removed; }
@Override public CacheRecord remove(Object key) { CacheRecord removedRecord = super.remove(key); if (removedRecord != null && entryCountingEnable) { // Removed cacheContext.decreaseEntryCount(); } return removedRecord; }
@Override public boolean remove(Object key, Object value) { boolean removed = super.remove(key, value); if (removed && entryCountingEnable) { // Removed cacheContext.decreaseEntryCount(); } return removed; }
@Override public CacheRecord remove(Object key) { CacheRecord removedRecord = super.remove(key); if (removedRecord != null && entryCountingEnable) { // Removed cacheContext.decreaseEntryCount(); } return removedRecord; }
/** * It works on best effort basis. If multi-threaded calls involved it may evict all elements, but it's unlikely. */ private void evictMap(SampleableConcurrentHashMap<?, ?> map, int triggeringEvictionSize, int afterEvictionSize) { map.purgeStaleEntries(); int mapSize = map.size(); if (mapSize - triggeringEvictionSize >= 0) { for (SampleableConcurrentHashMap.SamplingEntry entry : map.getRandomSamples(mapSize - afterEvictionSize)) { map.remove(entry.getEntryKey()); } } }
/** * It works on best effort basis. If multi-threaded calls involved it may evict all elements, but it's unlikely. */ private void evictMap(SampleableConcurrentHashMap<?, ?> map, int triggeringEvictionSize, int afterEvictionSize) { map.purgeStaleEntries(); int mapSize = map.size(); if (mapSize - triggeringEvictionSize >= 0) { for (SampleableConcurrentHashMap.SamplingEntry entry : map.getRandomSamples(mapSize - afterEvictionSize)) { map.remove(entry.getEntryKey()); } } }