|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
Objectorg.javaruntype.cache.ConcurrentCache<K,V>
K - key typeV - value typepublic final class ConcurrentCache<K,V>
Base synchronized cache for *Registry objects.
Do not use this class directly.
This class is thread-safe.
| Constructor Summary | |
|---|---|
ConcurrentCache()
Create a new synchronized cache. |
|
ConcurrentCache(int maxElements)
Create a new synchronized cache specifying a maximum size for the cache |
|
| Method Summary | |
|---|---|
void |
clear()
Clear the cache. |
V |
computeAndGet(K key,
V value)
Puts a value into the cache and returns it. |
V |
get(K key)
Get the value for a specific key |
| Methods inherited from class Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ConcurrentCache()
Create a new synchronized cache.
public ConcurrentCache(int maxElements)
Create a new synchronized cache specifying a maximum size for the cache
| Method Detail |
|---|
public void clear()
Clear the cache.
public V get(K key)
Get the value for a specific key
key - the key
public V computeAndGet(K key,
V value)
Puts a value into the cache and returns it. If a value already existed for the same key, the existing value is not modified and is returned instead of the one passed as parameter. This ensures only one object for each key exists at a time.
key - the key to which the value will be assignedvalue - the value which will be added to the map
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||