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 void
clear()
boolean
containsKey(Object key)
boolean
containsValue(Object value)
protected CachedValue<K,V>
create(K key, V value, long ttl, long maxIdleTime)
Set<Map.Entry<K,V>>
entrySet()
V
get(Object key)
boolean
isEmpty()
protected boolean
isFull(K key)
Set<K>
keySet()
protected abstract void
onMapFull()
protected void
onValueCreate(CachedValue<K,V> entry)
protected void
onValueRead(CachedValue<K,V> value)
protected void
onValueRemove(CachedValue<K,V> value)
V
put(K key, V value)
void
putAll(Map<? extends K,? extends V> m)
V
putIfAbsent(K key, V value)
protected V
readValue(CachedValue<K,V> entry)
V
remove(Object key)
boolean
remove(Object key, Object value)
protected boolean
removeExpiredEntries()
V
replace(K key, V value)
boolean
replace(K key, V oldValue, V newValue)
int
size()
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:
containsKey
in interfaceMap<K,V>
-
containsValue
public boolean containsValue(Object value)
- Specified by:
containsValue
in 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:
putIfAbsent
in interfaceConcurrentMap<K,V>
- Specified by:
putIfAbsent
in interfaceMap<K,V>
-
-