public class JCacheAdapter extends AbstractCacheAdapter<javax.cache.configuration.CacheEntryListenerConfiguration>
Cache.EntryListener, Cache.EntryListenerAdapter| Constructor and Description |
|---|
JCacheAdapter(javax.cache.Cache jCache)
Initialize the adapter to forward call to the given
jCache instance |
| Modifier and Type | Method and Description |
|---|---|
<K> boolean |
containsKey(K key)
Indicates whether there is an item stored under given
key. |
protected javax.cache.configuration.CacheEntryListenerConfiguration |
createListenerAdapter(Cache.EntryListener cacheEntryListener)
Creates an adapter for the given
cacheEntryListener. |
protected Registration |
doRegisterListener(javax.cache.configuration.CacheEntryListenerConfiguration listenerAdapter)
Registers the given listener with the cache implementation
|
<K,V> V |
get(K key)
Returns an item from the cache, or
null if no item was stored under that key |
<K,V> void |
put(K key,
V value)
Stores the given
value in the cache, under given key. |
<K,V> boolean |
putIfAbsent(K key,
V value)
Stores the given
value in the cache, under given key, if no element is yet available
under that key. |
<K> boolean |
remove(K key)
Removes the entry stored under given
key. |
registerCacheEntryListenerpublic JCacheAdapter(javax.cache.Cache jCache)
jCache instancejCache - The cache to forward all calls topublic <K,V> V get(K key)
Cachenull if no item was stored under that keyK - The type of key usedV - The type of value storedkey - The key under which the item was cachedpublic <K,V> void put(K key,
V value)
Cachevalue 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)
Cachevalue 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 cachetrue if no value was previously assigned to the key, false otherwise.public <K> boolean remove(K key)
Cachekey. If no such entry exists, nothing happens.K - The type of key usedkey - The key under which the item was storedtrue if a value was previously assigned to the key and has been removed, false
otherwise.public <K> boolean containsKey(K key)
Cachekey.K - The type of keykey - The key to checktrue if an item is available under that key, false otherwise.protected javax.cache.configuration.CacheEntryListenerConfiguration createListenerAdapter(Cache.EntryListener cacheEntryListener)
AbstractCacheAdaptercacheEntryListener. The adapter must forward all incoming
notifications to the respective methods on the cacheEntryListener.createListenerAdapter in class AbstractCacheAdapter<javax.cache.configuration.CacheEntryListenerConfiguration>cacheEntryListener - The listener to create an adapter forprotected Registration doRegisterListener(javax.cache.configuration.CacheEntryListenerConfiguration listenerAdapter)
AbstractCacheAdapterdoRegisterListener in class AbstractCacheAdapter<javax.cache.configuration.CacheEntryListenerConfiguration>listenerAdapter - the listener to registerCopyright © 2010–2018. All rights reserved.