|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
@PublicApi public interface Cache<K,V>
| Method Summary | |
|---|---|
V |
get(K key)
Retrieve an object from this cache. |
Collection<K> |
getKeys()
Gets the keys of all objects currently stored in the cache. |
String |
getName()
The name of the cache, uniquely identifies this cache. |
void |
put(K key,
V value)
Put an object into the cache. |
V |
putIfAbsent(K key,
V value)
Atomically associates the specified key with the given value if it is not already associated with a value. |
void |
remove(K key)
Remove the object identified by the key from the cache. |
boolean |
remove(K key,
V value)
Atomically removes the entry for a key only if currently mapped to a given value. |
void |
removeAll()
Remove all of the objects from this cache. |
boolean |
replace(K key,
V oldValue,
V newValue)
Atomically replaces the entry for a key only if currently mapped to a given value. |
| Method Detail |
|---|
String getName()
Collection<K> getKeys()
Objects keys.
V get(@NotNull
K key)
key - uniquely identifying the object to be retrieved.
null if the object is not found.
void put(@NotNull
K key,
V value)
NOTE: Users of caches that wish to be well behaved in a clustered environment should use the
CacheLoader semantics and supply a CacheLoader when getting the Cache.
key - uniquely identifying the object to be added into the cache.value - to be cached.
void remove(@NotNull
K key)
key - uniquely identifying the object to be removed.void removeAll()
V putIfAbsent(K key,
V value)
key - value -
null if there was no mapping for the key.
boolean replace(K key,
V oldValue,
V newValue)
key - key with which the specified value is associatedoldValue - value expected to be associated with the specified keynewValue - value to be associated with the specified key
true if the value was replaced, false otherwise
boolean remove(K key,
V value)
key - key with which the specified value is associatedvalue - value expected to be associated with the specified key
true if the value was removed, false otherwise
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||