K - keyV - valuepublic class JCache<K,V> extends RedissonObject implements javax.cache.Cache<K,V>, CacheAsync<K,V>
codec, commandExecutor, name| Constructor and Description |
|---|
JCache(JCacheManager cacheManager,
Redisson redisson,
String name,
JCacheConfiguration<K,V> config,
boolean hasOwnRedisson) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
checkKey(Object key) |
void |
clear() |
RFuture<Void> |
clearAsync()
This method empties the cache's contents, without notifying listeners or
CacheWriters. |
void |
close() |
boolean |
containsKey(K key) |
RFuture<Boolean> |
containsKeyAsync(K key)
This method returns a Boolean true/false value, depending on whether the
CacheAsync has a mapping for a key k such that key.equals(k). |
void |
deregisterCacheEntryListener(javax.cache.configuration.CacheEntryListenerConfiguration<K,V> cacheEntryListenerConfiguration) |
V |
get(K key) |
Map<K,V> |
getAll(Set<? extends K> keys) |
RFuture<Map<K,V>> |
getAllAsync(Set<? extends K> keys)
This method accepts a set of requested keys and retrieves a collection of entries from the
CacheAsync, returning them as a Map of the associated values. |
V |
getAndPut(K key,
V value) |
RFuture<V> |
getAndPutAsync(K key,
V value)
This method places the given key and value in the cache.
|
V |
getAndRemove(K key) |
RFuture<V> |
getAndRemoveAsync(K key)
This method atomically removes the entry for a key only if it is currently mapped to some
value.
|
V |
getAndReplace(K key,
V value) |
RFuture<V> |
getAndReplaceAsync(K key,
V value)
This method atomically replaces a given key's value if and only if the key is currently
mapped to a value.
|
RFuture<V> |
getAsync(K key)
This method retrieves an entry from the cache.
|
javax.cache.CacheManager |
getCacheManager() |
<C extends javax.cache.configuration.Configuration<K,V>> |
getConfiguration(Class<C> clazz) |
protected void |
handleException(RPromise<?> result,
Exception e) |
<T> T |
invoke(K key,
javax.cache.processor.EntryProcessor<K,V,T> entryProcessor,
Object... arguments) |
<T> Map<K,javax.cache.processor.EntryProcessorResult<T>> |
invokeAll(Set<? extends K> keys,
javax.cache.processor.EntryProcessor<K,V,T> entryProcessor,
Object... arguments) |
boolean |
isClosed() |
Iterator<javax.cache.Cache.Entry<K,V>> |
iterator() |
protected Iterator<K> |
keyIterator() |
void |
loadAll(Set<? extends K> keys,
boolean replaceExistingValues,
javax.cache.integration.CompletionListener completionListener) |
void |
put(K key,
V value) |
void |
putAll(Map<? extends K,? extends V> map) |
RFuture<Void> |
putAllAsync(Map<? extends K,? extends V> map)
This method copies all of the entries from the given Map to the
CacheAsync. |
RFuture<Void> |
putAsync(K key,
V value)
This method places the given value V in the cache and associates it with the given key K.
|
boolean |
putIfAbsent(K key,
V value) |
RFuture<Boolean> |
putIfAbsentAsync(K key,
V value)
This method places the given key and value in the cache atomically, if the key is
not already associated with a value in the cache.
|
void |
registerCacheEntryListener(javax.cache.configuration.CacheEntryListenerConfiguration<K,V> cacheEntryListenerConfiguration) |
boolean |
remove(K key) |
boolean |
remove(K key,
V value) |
void |
removeAll() |
void |
removeAll(Set<? extends K> keys) |
RFuture<Void> |
removeAllAsync(Set<? extends K> keys)
This method deletes the entries for the given keys.
|
RFuture<Boolean> |
removeAsync(K key)
This method deletes the mapping for a given key from the cache, if it is present.
|
RFuture<Boolean> |
removeAsync(K key,
V value)
This method atomically removes a key's mapping only if it is currently mapped to the
provided value.
|
boolean |
replace(K key,
V value) |
boolean |
replace(K key,
V oldValue,
V newValue) |
RFuture<Boolean> |
replaceAsync(K key,
V value)
This method atomically replaces an entry only if the key is currently mapped to some
value.
|
RFuture<Boolean> |
replaceAsync(K key,
V oldValue,
V newValue)
This method atomically replaces an entry only if the key is currently mapped to a
given value.
|
<T> T |
unwrap(Class<T> clazz) |
protected RPromise<Boolean> |
waitSync(double syncId,
RFuture<List<Object>> res) |
addListener, addListenerAsync, copy, copyAsync, delete, deleteAsync, dump, dumpAsync, encode, encode, encode, encodeMapKey, encodeMapKeys, encodeMapValue, encodeMapValues, get, getCodec, getLockByMapKey, getLockByValue, getName, getName, isExists, isExistsAsync, migrate, migrateAsync, move, moveAsync, prefixName, removeListener, removeListenerAsync, rename, renameAsync, renamenx, renamenxAsync, restore, restore, restoreAndReplace, restoreAndReplace, restoreAndReplaceAsync, restoreAndReplaceAsync, restoreAsync, restoreAsync, sizeInMemory, sizeInMemoryAsync, sizeInMemoryAsync, suffixName, toSeconds, toStream, touch, touchAsync, unlink, unlinkAsyncclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitforEach, spliteratorpublic JCache(JCacheManager cacheManager, Redisson redisson, String name, JCacheConfiguration<K,V> config, boolean hasOwnRedisson)
protected void checkKey(Object key)
public RFuture<V> getAsync(K key)
CacheAsyncCacheLoader
will try to load the entry.getAsync in interface CacheAsync<K,V>key - the key whose value should be returnedpublic RFuture<Map<K,V>> getAllAsync(Set<? extends K> keys)
CacheAsyncCacheAsync, returning them as a Map of the associated values.
If the cache uses the read-through pattern, and the method would return null for a key
because an entry is not present in the cache, the Cache's CacheLoader will try to
load the entry. If a key's entry cannot be loaded, the key will not appear in the Map.getAllAsync in interface CacheAsync<K,V>keys - The keys whose values should be returned.public boolean containsKey(K key)
public RFuture<Boolean> containsKeyAsync(K key)
CacheAsyncCacheAsync has a mapping for a key k such that key.equals(k).containsKeyAsync in interface CacheAsync<K,V>key - the key with a possible mapping in the cache.public void loadAll(Set<? extends K> keys, boolean replaceExistingValues, javax.cache.integration.CompletionListener completionListener)
public RFuture<Void> putAsync(K key, V value)
CacheAsyncCacheAsync already has a mapping for the key, the previous
value is replaced by the given value V.
This occurs if and only if c.containsKey(k)
would return true.)putAsync in interface CacheAsync<K,V>key - the key to place in the cachevalue - the value to associate with the given keypublic RFuture<V> getAndPutAsync(K key, V value)
CacheAsyncc.containsKey(k)
would return true.)
If there was no value already in the cache, the method returns null.getAndPutAsync in interface CacheAsync<K,V>key - the key to place in the cachevalue - the value to associate with the given keypublic RFuture<Void> putAllAsync(Map<? extends K,? extends V> map)
CacheAsyncCacheAsync.
This method is equivalent to calling
CacheAsync.putAsync(Object, Object) on this cache one time for each mapping
from key k to value v in the given Map.
Individual puts may occur in any order.
If entries in the cache corresponding to entries in the Map, or the Map itself, is
changed or removed during this operation, then the behavior of this method is
not defined.
If default consistency mode is enabled, then each put is atomic but not
the entire putAll operation. Listeners can observe individual updates.putAllAsync in interface CacheAsync<K,V>map - the Map that contains the entries to be copied to the cachepublic RFuture<Boolean> putIfAbsentAsync(K key, V value)
CacheAsyncputIfAbsentAsync in interface CacheAsync<K,V>key - the key to place in the cachevalue - the value to associate with the given keypublic RFuture<Boolean> removeAsync(K key)
CacheAsyncremoveAsync in interface CacheAsync<K,V>key - the key whose mapping will be deletedpublic RFuture<Boolean> removeAsync(K key, V value)
CacheAsyncremoveAsync in interface CacheAsync<K,V>key - the key whose mapping will be deletedvalue - the value that should be mapped to the given keypublic RFuture<V> getAndRemoveAsync(K key)
CacheAsyncgetAndRemoveAsync in interface CacheAsync<K,V>key - the given keypublic RFuture<Boolean> replaceAsync(K key, V oldValue, V newValue)
CacheAsyncreplaceAsync in interface CacheAsync<K,V>key - the key associated with the given oldValueoldValue - the value that should be associated with the keynewValue - the value that will be associated with the keypublic RFuture<Boolean> replaceAsync(K key, V value)
CacheAsyncreplaceAsync in interface CacheAsync<K,V>key - the key mapped to the given valuevalue - the value mapped to the given keypublic RFuture<V> getAndReplaceAsync(K key, V value)
CacheAsyncgetAndReplaceAsync in interface CacheAsync<K,V>key - the key associated with the given valuevalue - the value associated with the given keypublic RFuture<Void> removeAllAsync(Set<? extends K> keys)
CacheAsyncCacheEntryRemovedListeners
• if the cache is a write-through cache, the CacheWriter
If the key set is empty, the CacheWriter is not called.removeAllAsync in interface CacheAsync<K,V>keys - the keys to removepublic RFuture<Void> clearAsync()
CacheAsyncCacheWriters.clearAsync in interface CacheAsync<K,V>public <C extends javax.cache.configuration.Configuration<K,V>> C getConfiguration(Class<C> clazz)
public <T> T invoke(K key, javax.cache.processor.EntryProcessor<K,V,T> entryProcessor, Object... arguments) throws javax.cache.processor.EntryProcessorException
public <T> Map<K,javax.cache.processor.EntryProcessorResult<T>> invokeAll(Set<? extends K> keys, javax.cache.processor.EntryProcessor<K,V,T> entryProcessor, Object... arguments)
public javax.cache.CacheManager getCacheManager()
public void close()
public void registerCacheEntryListener(javax.cache.configuration.CacheEntryListenerConfiguration<K,V> cacheEntryListenerConfiguration)
public void deregisterCacheEntryListener(javax.cache.configuration.CacheEntryListenerConfiguration<K,V> cacheEntryListenerConfiguration)
Copyright © 2014–2019 Redisson. All rights reserved.