|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
K
- the type of the keys used to access data within this cacheV
- the type of the values held within this cachepublic interface Cache<K,V>
Basic interface to a cache, defines all operational methods to create, access, update or delete mappings of key to value
Nested Class Summary | |
---|---|
static interface |
Cache.Entry<K,V>
Represent a mapping of key to value held in a Cache |
Method Summary | |
---|---|
void |
clear()
Removes all mapping currently present in the Cache without invoking the CacheLoaderWriter or any
registered CacheEventListener instances
This is not an atomic operation and can potentially be very expensive |
boolean |
containsKey(K key)
Checks whether a mapping for the given key is present, without retrieving the associated value |
V |
get(K key)
Retrieve the value currently mapped to the provided key |
java.util.Map<K,V> |
getAll(java.util.Set<? extends K> keys)
Retrieves all values associated with the given keys. |
CacheRuntimeConfiguration<K,V> |
getRuntimeConfiguration()
Exposes the CacheRuntimeConfiguration associated with this Cache instance. |
void |
put(K key,
V value)
Associates the provided value to the given key |
void |
putAll(java.util.Map<? extends K,? extends V> entries)
Associates all the provided key:value pairs. |
V |
putIfAbsent(K key,
V value)
If the provided key is not associated with a value, then associate it with the provided value. |
void |
remove(K key)
Removes the value, if any, associated with the provided key |
boolean |
remove(K key,
V value)
If the provided key is associated with the provided value then remove the entry. |
void |
removeAll(java.util.Set<? extends K> keys)
Removes any associates for the given keys. |
V |
replace(K key,
V value)
If the provided key is associated with a value, then replace that value with the provided value. |
boolean |
replace(K key,
V oldValue,
V newValue)
If the provided key is associated with oldValue , then replace that value with newValue . |
Methods inherited from interface java.lang.Iterable |
---|
iterator |
Method Detail |
---|
V get(K key) throws CacheLoadingException
key
- the key to query the value for
java.lang.NullPointerException
- if the provided key is null
CacheLoadingException
- if the CacheLoaderWriter
associated with this cache was invoked and threw an Exception
void put(K key, V value) throws CacheWritingException
key
- the key, may not be nullvalue
- the value, may not be null
java.lang.NullPointerException
- if either key or value is null
CacheWritingException
- if the CacheLoaderWriter
associated with this cache threw an Exception
while writing the value for the given key to underlying system of record.boolean containsKey(K key)
key
- the key
java.lang.NullPointerException
- if the provided key is nullvoid remove(K key) throws CacheWritingException
key
- the key to remove the value for
java.lang.NullPointerException
- if the provided key is null
CacheWritingException
- if the CacheLoaderWriter
associated
with this cache threw an Exception
while removing the value for the
given key from the underlying system of record.java.util.Map<K,V> getAll(java.util.Set<? extends K> keys) throws BulkCacheLoadingException
keys
- keys to query for
null
if the key was not mapped
java.lang.NullPointerException
- if the Set
or any of the contained keys are null
.
BulkCacheLoadingException
- if loading some or all values failedvoid putAll(java.util.Map<? extends K,? extends V> entries) throws BulkCacheWritingException
entries
- key:value pairs to associate
java.lang.NullPointerException
- if the Map
or any of the contained keys or values are null
.
BulkCacheWritingException
- if the CacheLoaderWriter
associated with this cache threw an Exception
while writing given key:value pairs to underlying system of record.void removeAll(java.util.Set<? extends K> keys) throws BulkCacheWritingException
keys
- keys to remove values for
java.lang.NullPointerException
- if the Set
or any of the contained keys are null
.
BulkCacheWritingException
- if the CacheLoaderWriter
associated with this cache threw an Exception
while removing mappings for given keys from underlying system of record.void clear()
CacheLoaderWriter
or any
registered CacheEventListener
instances
This is not an atomic operation and can potentially be very expensive
V putIfAbsent(K key, V value) throws CacheLoadingException, CacheWritingException
key
- the key to be associated withvalue
- the value to associate
null
if none
java.lang.NullPointerException
- if either key or value is null
CacheLoadingException
- if the CacheLoaderWriter
associated with this cache was invoked and threw an Exception
while loading
the value for the key
CacheWritingException
- if the CacheLoaderWriter
associated with this cache threw an Exception
while writing the value for the given key to underlying system of record.boolean remove(K key, V value) throws CacheWritingException
key
- the key to removevalue
- the value to check against
true
if the entry was removed
java.lang.NullPointerException
- if either key or value is null
CacheWritingException
- if the CacheLoaderWriter
associated with this cache threw an Exception
while removing the given key:value mappingV replace(K key, V value) throws CacheLoadingException, CacheWritingException
key
- the key to be associated withvalue
- the value to associate
null
if none
java.lang.NullPointerException
- if either key or value is null
CacheLoadingException
- if the CacheLoaderWriter
associated with this cache was invoked and threw an Exception
while loading
the value for the key
CacheWritingException
- if the CacheLoaderWriter
associated with this cache was invoked and threw an Exception
while replacing value for given key on underlying system of record.boolean replace(K key, V oldValue, V newValue) throws CacheLoadingException, CacheWritingException
oldValue
, then replace that value with newValue
.
key
- the key to be associated witholdValue
- the value to check againstnewValue
- the value to associate
true
if the value was replaced
java.lang.NullPointerException
- if any of the values, or the key is null
CacheLoadingException
- if the CacheLoaderWriter
associated with this cache was invoked and threw an Exception
while loading
the value for the key
CacheWritingException
- if the CacheLoaderWriter
associated with this cache was invoked and threw an Exception
while replacing value for given key on underlying system of record.CacheRuntimeConfiguration<K,V> getRuntimeConfiguration()
CacheRuntimeConfiguration
associated with this Cache instance.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |