public class RedissonLocalCachedMap<K,V> extends RedissonMap<K,V> implements RLocalCachedMap<K,V>
| Modifier and Type | Field and Description |
|---|---|
static String |
DISABLED_ACK_SUFFIX |
static String |
DISABLED_KEYS_SUFFIX |
static String |
TOPIC_SUFFIX |
codec, commandExecutor, name| Constructor and Description |
|---|
RedissonLocalCachedMap(Codec codec,
CommandAsyncExecutor connectionManager,
String name,
LocalCachedMapOptions<K,V> options,
EvictionScheduler evictionScheduler,
RedissonClient redisson,
WriteBehindService writeBehindService) |
RedissonLocalCachedMap(CommandAsyncExecutor commandExecutor,
String name,
LocalCachedMapOptions<K,V> options,
EvictionScheduler evictionScheduler,
RedissonClient redisson,
WriteBehindService writeBehindService) |
| Modifier and Type | Method and Description |
|---|---|
protected RFuture<V> |
addAndGetOperationAsync(K key,
Number value) |
Set<Map.Entry<K,V>> |
cachedEntrySet()
Returns all map entries stored in local cache
|
Set<K> |
cachedKeySet()
Returns all keys stored in local cache
|
Collection<V> |
cachedValues()
Returns all values stored in local cache
|
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.
|
protected RFuture<Boolean> |
clearExpireAsync(String... keys) |
void |
clearLocalCache()
Clears local cache across all instances
|
RFuture<Void> |
clearLocalCacheAsync()
Clears local cache across all instances
|
RFuture<Boolean> |
containsKeyAsync(Object key)
Returns
true if this map contains map entry
mapped by specified key, otherwise false |
RFuture<Boolean> |
containsValueAsync(Object value)
Returns
true if this map contains any map entry
with specified value, otherwise false |
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(Instant instant)
Set an expire date for object.
|
boolean |
expire(long timeToLive,
TimeUnit timeUnit)
Set a timeout for object.
|
RFuture<Boolean> |
expireAsync(Instant instant)
Set an expire date for object.
|
RFuture<Boolean> |
expireAsync(long timeToLive,
TimeUnit timeUnit)
Set a timeout for object in async mode.
|
protected RFuture<Boolean> |
expireAsync(long timeToLive,
TimeUnit timeUnit,
String... keys) |
boolean |
expireAt(Date timestamp)
Use
RExpirable.expire(Instant) instead |
boolean |
expireAt(long timestamp)
Use
RExpirable.expire(Instant) instead |
RFuture<Boolean> |
expireAtAsync(Date timestamp)
Use
RExpirableAsync.expireAsync(Instant) instead |
RFuture<Boolean> |
expireAtAsync(long timestamp)
Use
RExpirableAsync.expireAsync(Instant) instead |
protected RFuture<Boolean> |
expireAtAsync(long timestamp,
String... keys) |
RFuture<Boolean> |
fastPutIfAbsentAsync(K key,
V value)
Stores the specified
value mapped by specified key
only if there is no value with specifiedkey stored before. |
RFuture<Boolean> |
fastPutIfExistsAsync(K key,
V value)
Stores the specified
value mapped by key
only if mapping already exists. |
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 mapped by specified key. |
protected RFuture<Boolean> |
fastReplaceOperationAsync(K key,
V value) |
protected static byte[] |
generateLogEntryId(byte[] keyHash) |
RFuture<Map<K,V>> |
getAllAsync(Set<K> keys)
Returns map slice contained the mappings with defined
keys. |
RFuture<V> |
getAsync(Object key)
Returns the value mapped by defined
key or null if value is absent. |
Map<K,V> |
getCachedMap()
Returns state of local cache
|
LocalCacheView<K,V> |
getLocalCacheView() |
void |
preloadCache()
Pre-warm the cached entries.
|
void |
preloadCache(int count)
Pre-warm the cached entries.
|
protected RFuture<Void> |
putAllOperationAsync(Map<? extends K,? extends V> map) |
RFuture<V> |
putIfAbsentAsync(K key,
V value)
Stores the specified
value mapped by specified key
only if there is no value with specifiedkey stored before. |
RFuture<V> |
putIfExistsAsync(K key,
V value)
Stores the specified
value mapped by key
only if mapping already exists. |
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 map entry only if it exists with specified
key and 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 mapped by specified key. |
RFuture<Boolean> |
replaceAsync(K key,
V oldValue,
V newValue)
Replaces previous
oldValue with a newValue mapped by specified key. |
protected RFuture<V> |
replaceOperationAsync(K key,
V value) |
protected RFuture<Boolean> |
replaceOperationAsync(K key,
V oldValue,
V newValue) |
RFuture<Integer> |
sizeAsync()
Returns size of this map
|
RFuture<Long> |
sizeInMemoryAsync()
Returns bytes amount used by object in Redis memory.
|
addAndGet, addAndGetAsync, checkKey, checkValue, clear, compute, computeAsync, computeIfAbsent, computeIfAbsentAsync, computeIfPresent, computeIfPresentAsync, containsKey, containsValue, entryIterator, entrySet, entrySet, entrySet, entrySet, equals, fastPut, fastPutAsync, fastPutIfAbsent, fastPutIfAbsentOperationAsync, fastPutIfExists, fastPutIfExistsOperationAsync, fastRemove, fastRemoveAsync, fastReplace, get, getAll, getAllOperationAsync, getCountDownLatch, getFairLock, getLock, getOperationAsync, getPermitExpirableSemaphore, getReadWriteLock, getSemaphore, hashCode, hasNoLoader, hasNoWriter, isEmpty, keyIterator, keySet, keySet, keySet, keySet, loadAll, loadAll, loadAllAsync, loadAllAsync, loadValue, mapReduce, mapWriterFuture, mapWriterFuture, merge, mergeAsync, put, putAll, putAll, putAllAsync, putAllAsync, putAsync, putIfAbsent, putIfAbsentOperationAsync, putIfExists, putIfExistsOperationAsync, randomEntries, randomEntriesAsync, randomKeys, randomKeysAsync, readAllEntrySet, readAllKeySet, readAllKeySetAsync, readAllMap, readAllValues, remove, remove, removeAsync, replace, replace, scanIterator, scanIteratorAsync, size, valueIterator, values, values, values, values, valueSize, valueSizeAsyncaddListener, addListener, addListenerAsync, addListenerAsync, copy, copyAsync, delete, deleteAsync, dump, dumpAsync, encode, encode, encode, encodeMapKey, encodeMapKeys, encodeMapValue, encodeMapValues, get, getCodec, getIdleTime, getIdleTimeAsync, getLockByMapKey, getLockByValue, getName, getRawName, getRawName, isExists, isExistsAsync, migrate, migrateAsync, move, moveAsync, prefixName, removeListener, removeListenerAsync, removeListenersAsync, rename, renameAsync, renamenx, renamenxAsync, restore, restore, restoreAndReplace, restoreAndReplace, restoreAndReplaceAsync, restoreAndReplaceAsync, restoreAsync, restoreAsync, setName, sizeInMemory, sizeInMemoryAsync, sizeInMemoryAsync, suffixName, toSeconds, toStream, touch, touchAsync, unlink, unlinkAsyncclone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitaddAndGet, containsKey, containsValue, entrySet, entrySet, entrySet, entrySet, fastPut, fastPutIfAbsent, fastPutIfExists, fastRemove, fastReplace, get, getAll, getCountDownLatch, getFairLock, getLock, getPermitExpirableSemaphore, getReadWriteLock, getSemaphore, keySet, keySet, keySet, keySet, loadAll, loadAll, mapReduce, put, putAll, putAll, putIfAbsent, putIfExists, randomEntries, randomKeys, readAllEntrySet, readAllKeySet, readAllMap, readAllValues, remove, remove, replace, replace, values, values, values, values, valueSizecompute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, replaceAllclearExpire, expire, expire, expireAt, expireAt, remainTimeToLiveaddListener, copy, delete, dump, getCodec, getIdleTime, getName, isExists, migrate, move, removeListener, rename, renamenx, restore, restore, restoreAndReplace, restoreAndReplace, sizeInMemory, touch, unlinkaddAndGetAsync, computeAsync, computeIfAbsentAsync, computeIfPresentAsync, fastPutAsync, fastRemoveAsync, loadAllAsync, loadAllAsync, mergeAsync, putAllAsync, putAllAsync, putAsync, randomEntriesAsync, randomKeysAsync, readAllKeySetAsync, removeAsync, valueSizeAsyncclearExpireAsync, expireAsync, expireAsync, expireAtAsync, expireAtAsync, remainTimeToLiveAsyncaddListenerAsync, copyAsync, dumpAsync, getIdleTimeAsync, isExistsAsync, migrateAsync, moveAsync, removeListenerAsync, renameAsync, renamenxAsync, restoreAndReplaceAsync, restoreAndReplaceAsync, restoreAsync, restoreAsync, 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, WriteBehindService writeBehindService)
public RedissonLocalCachedMap(Codec codec, CommandAsyncExecutor connectionManager, String name, LocalCachedMapOptions<K,V> options, EvictionScheduler evictionScheduler, RedissonClient redisson, WriteBehindService writeBehindService)
public LocalCacheView<K,V> getLocalCacheView()
public RFuture<Integer> sizeAsync()
RMapAsyncpublic RFuture<Boolean> containsKeyAsync(Object key)
RMapAsynctrue if this map contains map entry
mapped by specified key, otherwise falsecontainsKeyAsync in interface RMapAsync<K,V>containsKeyAsync in class RedissonMap<K,V>key - - map keytrue if this map contains map entry
mapped by specified key, otherwise falsepublic RFuture<Boolean> containsValueAsync(Object value)
RMapAsynctrue if this map contains any map entry
with specified value, otherwise falsecontainsValueAsync in interface RMapAsync<K,V>containsValueAsync in class RedissonMap<K,V>value - - map valuetrue if this map contains any map entry
with specified value, otherwise falsepublic RFuture<V> getAsync(Object key)
RMapAsynckey or null if value is absent.
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[] 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<Long> sizeInMemoryAsync()
RObjectAsyncsizeInMemoryAsync in interface RObjectAsyncsizeInMemoryAsync in class RedissonObjectpublic 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.
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 mapped by specified key
only if there is no value with specifiedkey stored before.
Returns true if key is a new one in the hash and value was set or
false if key already exists in the hash and change hasn't been made.
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<Boolean> fastPutIfExistsAsync(K key, V value)
RMapAsyncvalue mapped by key
only if mapping already exists.
Returns true if key is a new one in the hash and value was set or
false if key already exists in the hash and change hasn't been made.
Works faster than but doesn't return
previous value associated with RMapAsync.putIfExistsAsync(Object, Object)key
If MapWriter is defined then new map entry is stored in write-through mode.
fastPutIfExistsAsync in interface RMapAsync<K,V>fastPutIfExistsAsync in class RedissonMap<K,V>key - - map keyvalue - - map valuetrue if key already exists in the hash and new value has been stored.
false if key doesn't exist in the hash and value hasn't been set.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 preloadCache(int count)
RLocalCachedMapcount param.preloadCache in interface RLocalCachedMap<K,V>count - - size of batchpublic 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 mapped by specified key.
Works faster than but not returning
the previous value.
RMapAsync.replaceAsync(Object, Object)
Returns true if key exists and value was updated or
false if key doesn't exists and value wasn't updated.
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 mapped by specified key.
Returns null if there is no map entry stored before and doesn't store new map entry.
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 is no map entry stored before and doesn't store new map entryprotected 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 mapped by specified key.
Returns false if previous value doesn't exist or equal to oldValue.
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 and 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 removed otherwise false.public RFuture<V> putIfExistsAsync(K key, V value)
RMapAsyncvalue mapped by key
only if mapping already exists.
If MapWriter is defined then new map entry is stored in write-through mode.
putIfExistsAsync in interface RMapAsync<K,V>putIfExistsAsync in class RedissonMap<K,V>key - - map keyvalue - - map valuenull if key is doesn't exists in the hash and value hasn't been set.
Previous value if key already exists in the hash and new value has been stored.public RFuture<V> putIfAbsentAsync(K key, V value)
RMapAsyncvalue mapped by specified key
only if there is no value with specifiedkey stored before.
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 Set<K> cachedKeySet()
RLocalCachedMapcachedKeySet in interface RLocalCachedMap<K,V>public Collection<V> cachedValues()
RLocalCachedMapcachedValues in interface RLocalCachedMap<K,V>public Set<Map.Entry<K,V>> cachedEntrySet()
RLocalCachedMapcachedEntrySet in interface RLocalCachedMap<K,V>public Map<K,V> getCachedMap()
RLocalCachedMapgetCachedMap in interface RLocalCachedMap<K,V>public 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)
RExpirableRExpirable.expire(Instant) insteadexpireAt in interface RExpirabletimestamp - - expire date in milliseconds (Unix timestamp)true if the timeout was set and false if notpublic RFuture<Boolean> expireAtAsync(long timestamp)
RExpirableAsyncRExpirableAsync.expireAsync(Instant) insteadexpireAtAsync in interface RExpirableAsynctimestamp - - expire date in milliseconds (Unix timestamp)true if the timeout was set and false if notpublic boolean expire(Instant instant)
RExpirableexpire in interface RExpirableinstant - - expire datetrue if the timeout was set and false if notpublic RFuture<Boolean> expireAsync(Instant instant)
RExpirableAsyncexpireAsync in interface RExpirableAsyncinstant - - expire datetrue if the timeout was set and false if notpublic boolean expireAt(Date timestamp)
RExpirableRExpirable.expire(Instant) insteadexpireAt in interface RExpirabletimestamp - - expire datetrue if the timeout was set and false if notpublic RFuture<Boolean> expireAtAsync(Date timestamp)
RExpirableAsyncRExpirableAsync.expireAsync(Instant) insteadexpireAtAsync 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 RExpirableAsyncprotected RFuture<Boolean> expireAsync(long timeToLive, TimeUnit timeUnit, String... keys)
Copyright © 2014–2021 Redisson. All rights reserved.