public class RedissonLocalCachedMap<K,V> extends RedissonMap<K,V> implements RLocalCachedMap<K,V>
| Modifier and Type | Class and Description |
|---|---|
static class |
RedissonLocalCachedMap.CacheValue |
| Modifier and Type | Field and Description |
|---|---|
static String |
DISABLED_ACK_SUFFIX |
static String |
DISABLED_KEYS_SUFFIX |
static String |
TOPIC_SUFFIX |
codec, commandExecutor| Constructor and Description |
|---|
RedissonLocalCachedMap(Codec codec,
CommandAsyncExecutor connectionManager,
String name,
LocalCachedMapOptions<K,V> options,
EvictionScheduler evictionScheduler,
RedissonClient redisson) |
RedissonLocalCachedMap(CommandAsyncExecutor commandExecutor,
String name,
LocalCachedMapOptions<K,V> options,
EvictionScheduler evictionScheduler,
RedissonClient redisson) |
| Modifier and Type | Method and Description |
|---|---|
protected RFuture<V> |
addAndGetOperationAsync(K key,
Number value) |
boolean |
clearExpire()
Clear an expire timeout or expire date for object.
|
RFuture<Boolean> |
clearExpireAsync()
Clear an expire timeout or expire date for object in async mode.
|
void |
clearLocalCache()
Clears local cache across all instances
|
RFuture<Void> |
clearLocalCacheAsync()
Clears local cache across all instances
|
RFuture<Boolean> |
containsKeyAsync(Object key) |
RFuture<Boolean> |
containsValueAsync(Object value) |
protected Cache<CacheKey,RedissonLocalCachedMap.CacheValue> |
createCache(LocalCachedMapOptions<K,V> options) |
protected io.netty.buffer.ByteBuf |
createSyncMessage(io.netty.buffer.ByteBuf mapKey,
io.netty.buffer.ByteBuf mapValue,
CacheKey cacheKey) |
RFuture<Boolean> |
deleteAsync()
Delete object in async mode
|
void |
destroy()
Destroys object when it's not necessary anymore.
|
io.netty.buffer.ByteBuf |
encode(Object value) |
boolean |
expire(long timeToLive,
TimeUnit timeUnit)
Set a timeout for object.
|
RFuture<Boolean> |
expireAsync(long timeToLive,
TimeUnit timeUnit)
Set a timeout for object in async mode.
|
boolean |
expireAt(Date timestamp)
Set an expire date for object.
|
boolean |
expireAt(long timestamp)
Set an expire date for object.
|
RFuture<Boolean> |
expireAtAsync(Date timestamp)
Set an expire date for object in async mode.
|
RFuture<Boolean> |
expireAtAsync(long timestamp)
Set an expire date for object in async mode.
|
RFuture<Boolean> |
fastPutIfAbsentAsync(K key,
V value)
Associates the specified
value with the specified key
only if there is no any association with specifiedkey. |
protected RFuture<Boolean> |
fastPutOperationAsync(K key,
V value) |
protected RFuture<Long> |
fastRemoveOperationAsync(K... keys) |
protected RFuture<List<Long>> |
fastRemoveOperationBatchAsync(K... keys) |
RFuture<Boolean> |
fastReplaceAsync(K key,
V value)
Replaces previous value with a new
value associated with the key. |
protected RFuture<Boolean> |
fastReplaceOperationAsync(K key,
V value) |
protected static byte[] |
generateId() |
protected static byte[] |
generateLogEntryId(byte[] keyHash) |
RFuture<Map<K,V>> |
getAllAsync(Set<K> keys)
Gets a map slice contained the mappings with defined
keys
by one operation. |
RFuture<V> |
getAsync(Object key)
Returns the value to which the specified key is mapped,
or
null if this map contains no mapping for the key. |
void |
preloadCache()
Pre-warm the cached values.
|
protected RFuture<Void> |
putAllOperationAsync(Map<? extends K,? extends V> map) |
RFuture<V> |
putIfAbsentAsync(K key,
V value)
Associates the specified
value with the specified key
only if there is no any association with specifiedkey. |
protected RFuture<V> |
putOperationAsync(K key,
V value) |
RFuture<Set<Map.Entry<K,V>>> |
readAllEntrySetAsync()
Read all map entries at once
|
RFuture<Map<K,V>> |
readAllMapAsync()
Read all map as local instance at once
|
RFuture<Collection<V>> |
readAllValuesAsync()
Read all values at once
|
long |
remainTimeToLive()
Remaining time to live of Redisson object that has a timeout
|
RFuture<Long> |
remainTimeToLiveAsync()
Remaining time to live of Redisson object that has a timeout
|
RFuture<Boolean> |
removeAsync(Object key,
Object value)
Removes
key from map only if it associated with value. |
protected RFuture<V> |
removeOperationAsync(K key) |
protected RFuture<Boolean> |
removeOperationAsync(Object key,
Object value) |
RFuture<V> |
replaceAsync(K key,
V value)
Replaces previous value with a new
value associated with the key. |
RFuture<Boolean> |
replaceAsync(K key,
V oldValue,
V newValue)
Replaces previous
oldValue with a newValue associated with the key. |
protected RFuture<V> |
replaceOperationAsync(K key,
V value) |
protected RFuture<Boolean> |
replaceOperationAsync(K key,
V oldValue,
V newValue) |
CacheKey |
toCacheKey(Object key) |
addAndGet, addAndGetAsync, checkKey, checkValue, clear, containsKey, containsValue, entryIterator, entrySet, entrySet, entrySet, entrySet, equals, fastPut, fastPutAsync, fastPutIfAbsent, fastPutIfAbsentOperationAsync, fastRemove, fastRemoveAsync, fastReplace, get, getAll, getAllOperationAsync, getLock, getOperationAsync, getReadWriteLock, hashCode, hasNoLoader, hasNoWriter, isEmpty, keyIterator, keySet, keySet, keySet, keySet, loadAll, loadAll, loadAllAsync, loadAllAsync, mapReduce, mapWriterFuture, put, putAll, putAllAsync, putAsync, putIfAbsent, putIfAbsentOperationAsync, readAllEntrySet, readAllKeySet, readAllKeySetAsync, readAllMap, readAllValues, remove, remove, removeAsync, replace, replace, scanIterator, scanIteratorAsync, size, sizeAsync, valueIterator, values, values, values, values, valueSize, valueSizeAsyncawait, copy, copyAsync, delete, encode, encode, encodeMapKey, encodeMapKeys, encodeMapValue, encodeMapValues, get, getCodec, getName, getName, isExists, isExistsAsync, migrate, migrateAsync, move, moveAsync, prefixName, rename, renameAsync, renamenx, renamenxAsync, suffixName, toSeconds, touch, touchAsync, unlink, unlinkAsyncclone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitaddAndGet, entrySet, entrySet, entrySet, entrySet, fastPut, fastPutIfAbsent, fastRemove, fastReplace, get, getAll, getLock, getReadWriteLock, keySet, keySet, keySet, keySet, loadAll, loadAll, mapReduce, put, putAll, putIfAbsent, readAllEntrySet, readAllKeySet, readAllMap, readAllValues, remove, remove, replace, replace, values, values, values, values, valueSizecompute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, replaceAllclear, containsKey, containsValue, equals, hashCode, isEmpty, sizeclearExpire, expire, expireAt, expireAt, remainTimeToLivecopy, delete, getCodec, getName, isExists, migrate, move, rename, renamenx, touch, unlinkaddAndGetAsync, fastPutAsync, fastRemoveAsync, loadAllAsync, loadAllAsync, putAllAsync, putAsync, readAllKeySetAsync, removeAsync, sizeAsync, valueSizeAsyncclearExpireAsync, expireAsync, expireAtAsync, expireAtAsync, remainTimeToLiveAsynccopyAsync, isExistsAsync, migrateAsync, moveAsync, renameAsync, renamenxAsync, touchAsync, unlinkAsyncpublic static final String TOPIC_SUFFIX
public static final String DISABLED_KEYS_SUFFIX
public static final String DISABLED_ACK_SUFFIX
public RedissonLocalCachedMap(CommandAsyncExecutor commandExecutor, String name, LocalCachedMapOptions<K,V> options, EvictionScheduler evictionScheduler, RedissonClient redisson)
public RedissonLocalCachedMap(Codec codec, CommandAsyncExecutor connectionManager, String name, LocalCachedMapOptions<K,V> options, EvictionScheduler evictionScheduler, RedissonClient redisson)
protected Cache<CacheKey,RedissonLocalCachedMap.CacheValue> createCache(LocalCachedMapOptions<K,V> options)
public RFuture<Boolean> containsKeyAsync(Object key)
containsKeyAsync in interface RMapAsync<K,V>containsKeyAsync in class RedissonMap<K,V>public RFuture<Boolean> containsValueAsync(Object value)
containsValueAsync in interface RMapAsync<K,V>containsValueAsync in class RedissonMap<K,V>public RFuture<V> getAsync(Object key)
RMapAsyncnull if this map contains no mapping for the key.
If map doesn't contain value for specified key and MapLoader is defined
then value will be loaded in read-through mode.
protected static byte[] generateId()
protected static byte[] generateLogEntryId(byte[] keyHash)
protected RFuture<V> putOperationAsync(K key, V value)
putOperationAsync in class RedissonMap<K,V>protected io.netty.buffer.ByteBuf createSyncMessage(io.netty.buffer.ByteBuf mapKey,
io.netty.buffer.ByteBuf mapValue,
CacheKey cacheKey)
protected RFuture<Boolean> fastPutOperationAsync(K key, V value)
fastPutOperationAsync in class RedissonMap<K,V>public void destroy()
RDestroyabledestroy in interface RDestroyableprotected RFuture<V> removeOperationAsync(K key)
removeOperationAsync in class RedissonMap<K,V>protected RFuture<List<Long>> fastRemoveOperationBatchAsync(K... keys)
fastRemoveOperationBatchAsync in class RedissonMap<K,V>protected RFuture<Long> fastRemoveOperationAsync(K... keys)
fastRemoveOperationAsync in class RedissonMap<K,V>public RFuture<Boolean> deleteAsync()
RObjectAsyncdeleteAsync in interface RObjectAsyncdeleteAsync in class RedissonObjecttrue if object was deleted false if notpublic RFuture<Map<K,V>> getAllAsync(Set<K> keys)
RMapAsynckeys
by one operation.
If map doesn't contain value/values for specified key/keys and MapLoader is defined
then value/values will be loaded in read-through mode.
The returned map is NOT backed by the original map.
getAllAsync in interface RMapAsync<K,V>getAllAsync in class RedissonMap<K,V>keys - - map keysprotected RFuture<Void> putAllOperationAsync(Map<? extends K,? extends V> map)
putAllOperationAsync in class RedissonMap<K,V>protected RFuture<V> addAndGetOperationAsync(K key, Number value)
addAndGetOperationAsync in class RedissonMap<K,V>public RFuture<Boolean> fastPutIfAbsentAsync(K key, V value)
RMapAsyncvalue with the specified key
only if there is no any association with specifiedkey.
Works faster than but not returning
the previous value associated with RMapAsync.putIfAbsentAsync(Object, Object)key
If MapWriter is defined then new map entry is stored in write-through mode.
fastPutIfAbsentAsync in interface RMapAsync<K,V>fastPutIfAbsentAsync in class RedissonMap<K,V>key - - map keyvalue - - map valuetrue if key is a new one in the hash and value was set.
false if key already exists in the hash and change hasn't been made.public RFuture<Collection<V>> readAllValuesAsync()
RMapAsyncreadAllValuesAsync in interface RMapAsync<K,V>readAllValuesAsync in class RedissonMap<K,V>public RFuture<Map<K,V>> readAllMapAsync()
RMapAsyncreadAllMapAsync in interface RMapAsync<K,V>readAllMapAsync in class RedissonMap<K,V>public void preloadCache()
RLocalCachedMappreloadCache in interface RLocalCachedMap<K,V>public void clearLocalCache()
RLocalCachedMapclearLocalCache in interface RLocalCachedMap<K,V>public RFuture<Void> clearLocalCacheAsync()
RLocalCachedMapclearLocalCacheAsync in interface RLocalCachedMap<K,V>public RFuture<Set<Map.Entry<K,V>>> readAllEntrySetAsync()
RMapAsyncreadAllEntrySetAsync in interface RMapAsync<K,V>readAllEntrySetAsync in class RedissonMap<K,V>public RFuture<Boolean> fastReplaceAsync(K key, V value)
RMapAsyncvalue associated with the key.
Works faster than but not returning
the previous value associated with RMapAsync.replaceAsync(Object, Object)key
If MapWriter is defined then new map entry is stored in write-through mode.
fastReplaceAsync in interface RMapAsync<K,V>fastReplaceAsync in class RedissonMap<K,V>key - - map keyvalue - - map valuetrue if key exists and value was updated.
false if key doesn't exists and value wasn't updated.protected RFuture<Boolean> fastReplaceOperationAsync(K key, V value)
fastReplaceOperationAsync in class RedissonMap<K,V>protected RFuture<V> replaceOperationAsync(K key, V value)
replaceOperationAsync in class RedissonMap<K,V>public RFuture<V> replaceAsync(K key, V value)
RMapAsyncvalue associated with the key.
If there wasn't any association before then method returns null.
If MapWriter is defined then new valueis written in write-through mode.
replaceAsync in interface RMapAsync<K,V>replaceAsync in class RedissonMap<K,V>key - - map keyvalue - - map valuenull if there wasn't any association and change hasn't been madeprotected RFuture<Boolean> replaceOperationAsync(K key, V oldValue, V newValue)
replaceOperationAsync in class RedissonMap<K,V>public RFuture<Boolean> replaceAsync(K key, V oldValue, V newValue)
RMapAsyncoldValue with a newValue associated with the key.
If previous value doesn't exist or equal to oldValue then method returns false.
If MapWriter is defined then newValueis written in write-through mode.
replaceAsync in interface RMapAsync<K,V>replaceAsync in class RedissonMap<K,V>key - - map keyoldValue - - map old valuenewValue - - map new valuetrue if value has been replaced otherwise false.protected RFuture<Boolean> removeOperationAsync(Object key, Object value)
removeOperationAsync in class RedissonMap<K,V>public RFuture<Boolean> removeAsync(Object key, Object value)
RMapAsynckey from map only if it associated with value.
If MapWriter is defined then keyis deleted in write-through mode.
removeAsync in interface RMapAsync<K,V>removeAsync in class RedissonMap<K,V>key - - map keyvalue - - map valuetrue if map entry has been replaced otherwise false.public RFuture<V> putIfAbsentAsync(K key, V value)
RMapAsyncvalue with the specified key
only if there is no any association with specifiedkey.
If MapWriter is defined then new map entry is stored in write-through mode.
putIfAbsentAsync in interface RMapAsync<K,V>putIfAbsentAsync in class RedissonMap<K,V>key - - map keyvalue - - map valuenull if key is a new one in the hash and value was set.
Previous value if key already exists in the hash and change hasn't been made.public io.netty.buffer.ByteBuf encode(Object value)
encode in class RedissonObjectpublic boolean expire(long timeToLive,
TimeUnit timeUnit)
RExpirableexpire in interface RExpirabletimeToLive - - timeout before object will be deletedtimeUnit - - timeout time unittrue if the timeout was set and false if notpublic RFuture<Boolean> expireAsync(long timeToLive, TimeUnit timeUnit)
RExpirableAsyncexpireAsync in interface RExpirableAsynctimeToLive - - timeout before object will be deletedtimeUnit - - timeout time unittrue if the timeout was set and false if notpublic boolean expireAt(long timestamp)
RExpirableexpireAt in interface RExpirabletimestamp - - expire date in milliseconds (Unix timestamp)true if the timeout was set and false if notpublic RFuture<Boolean> expireAtAsync(long timestamp)
RExpirableAsyncexpireAtAsync in interface RExpirableAsynctimestamp - - expire date in seconds (Unix timestamp)true if the timeout was set and false if notpublic boolean expireAt(Date timestamp)
RExpirableexpireAt in interface RExpirabletimestamp - - expire datetrue if the timeout was set and false if notpublic RFuture<Boolean> expireAtAsync(Date timestamp)
RExpirableAsyncexpireAtAsync in interface RExpirableAsynctimestamp - - expire datetrue if the timeout was set and false if notpublic boolean clearExpire()
RExpirableclearExpire in interface RExpirabletrue if timeout was removed
false if object does not exist or does not have an associated timeoutpublic RFuture<Boolean> clearExpireAsync()
RExpirableAsyncclearExpireAsync in interface RExpirableAsynctrue if the timeout was cleared and false if notpublic long remainTimeToLive()
RExpirableremainTimeToLive in interface RExpirablepublic RFuture<Long> remainTimeToLiveAsync()
RExpirableAsyncremainTimeToLiveAsync in interface RExpirableAsyncCopyright © 2014–2018 The Redisson Project. All rights reserved.