|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
K
- V
- public interface ConcurrentHashMapCache<K,V>
A thread-safe hash map where the entries expire after a specified
time-to-live. The cache is designed such that read-only operations such as
Map.get(Object)
are fast while operations that modify the map may be
wrapped in ReentrantLock
s where necessary.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface java.util.Map |
---|
Map.Entry<K,V> |
Method Summary | |
---|---|
boolean |
containsKey(Object key)
Tests if the specified object is a key in this table. |
boolean |
containsValue(Object value)
Returns true if this map maps one or more keys to the
specified value. |
CacheManager |
getCacheManager()
Get the cache manager responsible for this cache. |
int |
getMaxEntries()
The maximum number of entries this map will contain. |
String |
getName()
Get the name of this cache. |
long |
getTtlMillis()
The default number of milliseconds each entry in the map will stay before being cleared out. |
boolean |
isRefreshTtl()
If true, entries retrieved with Map.get(Object) or similar will have
their expiry time refreshed. |
V |
put(K key,
V value,
long thisttl_millisec)
Put an entry in with the specific time to live. |
V |
put(K key,
V value,
long thisttl,
TimeUnit time_unit)
Put an entry in with the specific time to live. |
void |
putAll(Map<? extends K,? extends V> map,
long thisttl_millisec)
Copies all of the mappings from the specified map to this map, with a specific time to live. |
void |
putAll(Map<? extends K,? extends V> map,
long thisttl,
TimeUnit time_unit)
Copies all of the mappings from the specified map to this map, with the specified time to live. |
V |
putIfAbsent(K key,
V value,
long thisttl_millisec)
If the specified key is not already associated with a value, associate it with the given value using a specified time to live. |
V |
putIfAbsent(K key,
V value,
long thisttl,
TimeUnit time_unit)
If the specified key is not already associated with a value, associate it with the given value using a specified time to live. |
V |
replace(K key,
V value,
long thisttl_millisec)
Replaces the entry for a key only if currently mapped to some value. |
V |
replace(K key,
V value,
long thisttl,
TimeUnit time_unit)
Replaces the entry for a key only if currently mapped to some value. |
boolean |
replace(K key,
V old_value,
V new_value,
long thisttl_millisec)
Replaces the entry for a key only if currently mapped to a given value. |
boolean |
replace(K key,
V old_value,
V new_value,
long thisttl,
TimeUnit time_unit)
Replaces the entry for a key only if currently mapped to a given value. |
void |
setMaxEntries(int max_entries)
Set the maximum number of entries the map can contain (zero for unbounded). |
void |
setTtl(long ttl,
TimeUnit time_unit)
Set the default time to live for new entries. |
Methods inherited from interface java.util.concurrent.ConcurrentMap |
---|
putIfAbsent, remove, replace, replace |
Methods inherited from interface java.util.Map |
---|
clear, entrySet, equals, get, hashCode, isEmpty, keySet, put, putAll, remove, size, values |
Method Detail |
---|
boolean containsKey(Object key)
containsKey
in interface Map<K,V>
key
- Possible key.
true
if and only if the specified object is a key in
this table, as determined by the equals
method;
false
otherwise.boolean containsValue(Object value)
true
if this map maps one or more keys to the
specified value. Note: This method requires a full internal traversal of
the hash table, and so is much slower than method containsKey
.
containsValue
in interface Map<K,V>
value
- Value whose presence in this map is to be tested.
true
if this map maps one or more keys to the
specified value.CacheManager getCacheManager()
int getMaxEntries()
String getName()
long getTtlMillis()
boolean isRefreshTtl()
Map.get(Object)
or similar will have
their expiry time refreshed.
V put(K key, V value, long thisttl_millisec)
key
- value
- thisttl_millisec
-
V put(K key, V value, long thisttl, TimeUnit time_unit)
key
- value
- thisttl
- time_unit
-
void putAll(Map<? extends K,? extends V> map, long thisttl_millisec)
map
- thisttl_millisec
- void putAll(Map<? extends K,? extends V> map, long thisttl, TimeUnit time_unit)
map
- thisttl
- time_unit
- V putIfAbsent(K key, V value, long thisttl_millisec)
key
- value
- thisttl_millisec
-
null
if there was no mapping for the key.V putIfAbsent(K key, V value, long thisttl, TimeUnit time_unit)
key
- value
- thisttl
- time_unit
-
null
if there was no mapping for the key.V replace(K key, V value, long thisttl_millisec)
key
- value
- thisttl_millisec
-
null
if there was no mapping for the key.V replace(K key, V value, long thisttl, TimeUnit time_unit)
key
- value
- thisttl
- time_unit
-
null
if there was no mapping for the key.boolean replace(K key, V old_value, V new_value, long thisttl_millisec)
key
- old_value
- new_value
- thisttl_millisec
-
boolean replace(K key, V old_value, V new_value, long thisttl, TimeUnit time_unit)
key
- old_value
- new_value
- thisttl
- time_unit
-
void setMaxEntries(int max_entries)
max_entries
- void setTtl(long ttl, TimeUnit time_unit)
ttl
- time_unit
-
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |