Package org.redisson.cache
Class AbstractCacheMap<K,V>
- java.lang.Object
-
- org.redisson.cache.AbstractCacheMap<K,V>
-
- Type Parameters:
K- keyV- value
- All Implemented Interfaces:
ConcurrentMap<K,V>,Map<K,V>,Cache<K,V>
- Direct Known Subclasses:
LFUCacheMap,LRUCacheMap,NoneCacheMap,ReferenceCacheMap
public abstract class AbstractCacheMap<K,V> extends Object implements Cache<K,V>
- Author:
- Nikita Koksharov
-
-
Constructor Summary
Constructors Constructor Description AbstractCacheMap(int size, long timeToLiveInMillis, long maxIdleInMillis)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidclear()booleancontainsKey(Object key)booleancontainsValue(Object value)protected CachedValue<K,V>create(K key, V value, long ttl, long maxIdleTime)Set<Map.Entry<K,V>>entrySet()Vget(Object key)booleanisEmpty()protected booleanisFull(K key)Set<K>keySet()protected abstract voidonMapFull()protected voidonValueCreate(CachedValue<K,V> entry)protected voidonValueRead(CachedValue<K,V> value)protected voidonValueRemove(CachedValue<K,V> value)Vput(K key, V value)voidputAll(Map<? extends K,? extends V> m)VputIfAbsent(K key, V value)protected VreadValue(CachedValue<K,V> entry)Vremove(Object key)booleanremove(Object key, Object value)protected booleanremoveExpiredEntries()Vreplace(K key, V value)booleanreplace(K key, V oldValue, V newValue)intsize()Collection<V>values()-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.util.concurrent.ConcurrentMap
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, replaceAll
-
-
-
-
Method Detail
-
onValueRead
protected void onValueRead(CachedValue<K,V> value)
-
onValueRemove
protected void onValueRemove(CachedValue<K,V> value)
-
containsKey
public boolean containsKey(Object key)
- Specified by:
containsKeyin interfaceMap<K,V>
-
containsValue
public boolean containsValue(Object value)
- Specified by:
containsValuein interfaceMap<K,V>
-
readValue
protected V readValue(CachedValue<K,V> entry)
-
create
protected CachedValue<K,V> create(K key, V value, long ttl, long maxIdleTime)
-
onValueCreate
protected void onValueCreate(CachedValue<K,V> entry)
-
removeExpiredEntries
protected boolean removeExpiredEntries()
-
onMapFull
protected abstract void onMapFull()
-
isFull
protected boolean isFull(K key)
-
putIfAbsent
public V putIfAbsent(K key, V value)
- Specified by:
putIfAbsentin interfaceConcurrentMap<K,V>- Specified by:
putIfAbsentin interfaceMap<K,V>
-
-