|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Cache
Abstraction for a Caching mechanism. All Axon component rely on this abstraction, so that different
providers can be plugged in. In future versions, this abstraction may be replaced with the javax.cache
api, as soon as that api is final.
Nested Class Summary | |
---|---|
static interface |
Cache.EntryListener
Interface describing callback methods, which are invoked when changes are made in the underlying cache. |
static class |
Cache.EntryListenerAdapter
Adapter implementation for the EntryListener, allowing for overriding only specific callback methods. |
Method Summary | ||
---|---|---|
|
containsKey(K key)
Indicates whether there is an item stored under given key . |
|
|
get(K key)
Returns an item from the cache, or null if no item was stored under that key |
|
|
put(K key,
V value)
Stores the given value in the cache, under given key . |
|
|
putIfAbsent(K key,
V value)
Stores the given value in the cache, under given key , if no element is yet available
under that key. |
|
void |
registerCacheEntryListener(Cache.EntryListener cacheEntryListener)
Registers the given cacheEntryListener to listen for Cache changes. |
|
|
remove(K key)
Removes the entry stored under given key . |
|
void |
unregisterCacheEntryListener(Cache.EntryListener cacheEntryListener)
Unregisters the previously registered cacheEntryListener . |
Method Detail |
---|
<K,V> V get(K key)
null
if no item was stored under that key
K
- The type of key usedV
- The type of value storedkey
- The key under which the item was cached
<K,V> void put(K key, V value)
value
in the cache, under given key
. If an item already exists,
it is updated with the new value.
K
- The type of key usedV
- The type of value storedkey
- The key under which to store the itemvalue
- The item to cache<K,V> boolean putIfAbsent(K key, V value)
value
in the cache, under given key
, if no element is yet available
under that key. This operation is performed atomically.
K
- The type of key usedV
- The type of value storedkey
- The key under which to store the itemvalue
- The item to cache
true
if no value was previously assigned to the key, false
otherwise.<K> boolean remove(K key)
key
. If no such entry exists, nothing happens.
K
- The type of key usedkey
- The key under which the item was stored
true
if a value was previously assigned to the key and has been removed, false
otherwise.<K> boolean containsKey(K key)
key
.
K
- The type of keykey
- The key to check
true
if an item is available under that key, false
otherwise.void registerCacheEntryListener(Cache.EntryListener cacheEntryListener)
cacheEntryListener
to listen for Cache changes.
cacheEntryListener
- The listener to registervoid unregisterCacheEntryListener(Cache.EntryListener cacheEntryListener)
cacheEntryListener
.
cacheEntryListener
- The listener to unregister
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |