|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.axonframework.cache.AbstractCacheAdapter<net.sf.ehcache.event.CacheEventListener> org.axonframework.cache.EhCacheAdapter
public class EhCacheAdapter
Cache implementation that delegates all calls to an EhCache instance.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface org.axonframework.cache.Cache |
---|
Cache.EntryListener, Cache.EntryListenerAdapter |
Constructor Summary | |
---|---|
EhCacheAdapter(net.sf.ehcache.Ehcache ehCache)
Initialize the adapter to forward all call to the given ehCache instance |
Method Summary | ||
---|---|---|
|
containsKey(K key)
Indicates whether there is an item stored under given key . |
|
protected org.axonframework.cache.EhCacheAdapter.CacheEventListenerAdapter |
createListenerAdapter(Cache.EntryListener cacheEntryListener)
Creates an adapter for the given cacheEntryListener . |
|
protected void |
doRegisterListener(net.sf.ehcache.event.CacheEventListener listenerAdapter)
Registers the given listener with the cache implementation |
|
protected void |
doUnregisterListener(net.sf.ehcache.event.CacheEventListener listenerAdapter)
Unregisters the given listener with the cache |
|
|
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. |
|
|
remove(K key)
Removes the entry stored under given key . |
Methods inherited from class org.axonframework.cache.AbstractCacheAdapter |
---|
registerCacheEntryListener, unregisterCacheEntryListener |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public EhCacheAdapter(net.sf.ehcache.Ehcache ehCache)
ehCache
instance
ehCache
- The cache instance to forward calls toMethod Detail |
---|
public <K,V> V get(K key)
Cache
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
public <K,V> void put(K key, V value)
Cache
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 cachepublic <K,V> boolean putIfAbsent(K key, V value)
Cache
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.public <K> boolean remove(K key)
Cache
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.public <K> boolean containsKey(K key)
Cache
key
.
K
- The type of keykey
- The key to check
true
if an item is available under that key, false
otherwise.protected org.axonframework.cache.EhCacheAdapter.CacheEventListenerAdapter createListenerAdapter(Cache.EntryListener cacheEntryListener)
AbstractCacheAdapter
cacheEntryListener
. The adapter must forward all incoming
notifications to the respective methods on the cacheEntryListener
.
createListenerAdapter
in class AbstractCacheAdapter<net.sf.ehcache.event.CacheEventListener>
cacheEntryListener
- The listener to create an adapter for
protected void doUnregisterListener(net.sf.ehcache.event.CacheEventListener listenerAdapter)
AbstractCacheAdapter
listener
with the cache
doUnregisterListener
in class AbstractCacheAdapter<net.sf.ehcache.event.CacheEventListener>
listenerAdapter
- The listener to register with the cacheprotected void doRegisterListener(net.sf.ehcache.event.CacheEventListener listenerAdapter)
AbstractCacheAdapter
doRegisterListener
in class AbstractCacheAdapter<net.sf.ehcache.event.CacheEventListener>
listenerAdapter
- the listener to register
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |