K
- the type of the keyV
- the type of the valuepublic class ConcurrentCacheMap<K,V> extends Object implements ConcurrentMap<K,V>
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_TIME_TO_LIVE
Time to live for a value.
|
static int |
MAX_ENTRIES
Max.
|
static int |
SEGMENT_NR
Number of segments that can be accessed concurrently
|
Constructor and Description |
---|
ConcurrentCacheMap()
Creates a new instance of ConcurrentCacheMap using the supplied values
and a
CacheMap for the internal data structure. |
ConcurrentCacheMap(int timeToLive,
int maxEntries)
Creates a new instance of ConcurrentCacheMap using the supplied values
and a
CacheMap for the internal data structure. |
ConcurrentCacheMap(int timeToLive,
int maxEntries,
boolean refreshTimeout)
Creates a new instance of ConcurrentCacheMap using the supplied values
and a
CacheMap for the internal data structure. |
Modifier and Type | Method and Description |
---|---|
void |
clear() |
boolean |
containsKey(Object key) |
boolean |
containsValue(Object value) |
Set<Map.Entry<K,V>> |
entrySet() |
int |
expiredCounter() |
V |
get(Object key) |
int |
hashCode() |
boolean |
isEmpty() |
Set<K> |
keySet() |
V |
put(K key,
V value) |
void |
putAll(Map<? extends K,? extends V> inMap) |
V |
putIfAbsent(K key,
V value) |
V |
remove(Object key) |
boolean |
remove(Object key,
Object value) |
V |
replace(K key,
V value) |
boolean |
replace(K key,
V oldValue,
V newValue) |
int |
size() |
Collection<V> |
values() |
public static final int SEGMENT_NR
public static final int MAX_ENTRIES
public static final int DEFAULT_TIME_TO_LIVE
public ConcurrentCacheMap()
CacheMap
for the internal data structure.public ConcurrentCacheMap(int timeToLive, int maxEntries)
CacheMap
for the internal data structure.timeToLive
- The time-to-live value (seconds)maxEntries
- Set the maximum number of entries until items gets replaced
with LRUpublic ConcurrentCacheMap(int timeToLive, int maxEntries, boolean refreshTimeout)
CacheMap
for the internal data structure.timeToLive
- The time-to-live value (seconds)maxEntries
- The maximum entries to keep in cache, default is 1024refreshTimeout
- If set to true, timeout will be reset in case of
putIfAbsent(Object, Object)
public V putIfAbsent(K key, V value)
putIfAbsent
in interface ConcurrentMap<K,V>
public boolean remove(Object key, Object value)
remove
in interface ConcurrentMap<K,V>
public boolean containsKey(Object key)
containsKey
in interface Map<K,V>
public boolean containsValue(Object value)
containsValue
in interface Map<K,V>
public int hashCode()
public boolean replace(K key, V oldValue, V newValue)
replace
in interface ConcurrentMap<K,V>
public int expiredCounter()
Copyright © 2013. All Rights Reserved.