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(long timeToLive,
TimeUnit timeUnit)
Set a timeout 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)
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.
|
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. |
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
|
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. |
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.
|
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, getCountDownLatch, getFairLock, getLock, getOperationAsync, getPermitExpirableSemaphore, getReadWriteLock, getSemaphore, hashCode, hasNoLoader, hasNoWriter, isEmpty, keyIterator, keySet, keySet, keySet, keySet, loadAll, loadAll, loadAllAsync, loadAllAsync, mapReduce, mapWriterFuture, mapWriterFuture, put, putAll, putAll, putAllAsync, putAllAsync, putAsync, putIfAbsent, putIfAbsentOperationAsync, readAllEntrySet, readAllKeySet, readAllKeySetAsync, readAllMap, readAllValues, remove, remove, removeAsync, replace, replace, scanIterator, scanIteratorAsync, size, valueIterator, values, values, values, values, valueSize, valueSizeAsync
addListener, addListener, addListenerAsync, 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, removeListenersAsync, rename, renameAsync, renamenx, renamenxAsync, restore, restore, restoreAndReplace, restoreAndReplace, restoreAndReplaceAsync, restoreAndReplaceAsync, restoreAsync, restoreAsync, sizeInMemory, sizeInMemoryAsync, suffixName, toSeconds, toStream, touch, touchAsync, unlink, unlinkAsync
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
addAndGet, containsKey, containsValue, entrySet, entrySet, entrySet, entrySet, fastPut, fastPutIfAbsent, fastRemove, fastReplace, get, getAll, getCountDownLatch, getFairLock, getLock, getPermitExpirableSemaphore, getReadWriteLock, getSemaphore, keySet, keySet, keySet, keySet, loadAll, loadAll, mapReduce, put, putAll, putAll, putIfAbsent, readAllEntrySet, readAllKeySet, readAllMap, readAllValues, remove, remove, replace, replace, values, values, values, values, valueSize
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, replaceAll
clearExpire, expire, expireAt, expireAt, remainTimeToLive
addListener, copy, delete, dump, getCodec, getName, isExists, migrate, move, removeListener, rename, renamenx, restore, restore, restoreAndReplace, restoreAndReplace, sizeInMemory, touch, unlink
addAndGetAsync, fastPutAsync, fastRemoveAsync, loadAllAsync, loadAllAsync, putAllAsync, putAllAsync, putAsync, readAllKeySetAsync, removeAsync, valueSizeAsync
clearExpireAsync, expireAsync, expireAtAsync, expireAtAsync, remainTimeToLiveAsync
addListenerAsync, copyAsync, dumpAsync, isExistsAsync, migrateAsync, moveAsync, removeListenerAsync, renameAsync, renamenxAsync, restoreAndReplaceAsync, restoreAndReplaceAsync, restoreAsync, restoreAsync, touchAsync, unlinkAsync
public 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 RFuture<Integer> sizeAsync()
RMapAsync
public RFuture<Boolean> containsKeyAsync(Object key)
RMapAsync
true
if this map contains map entry
mapped by specified key
, otherwise false
containsKeyAsync
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 false
public RFuture<Boolean> containsValueAsync(Object value)
RMapAsync
true
if this map contains any map entry
with specified value
, otherwise false
containsValueAsync
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 false
public RFuture<V> getAsync(Object key)
RMapAsync
key
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()
RDestroyable
destroy
in interface RDestroyable
protected 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()
RObjectAsync
sizeInMemoryAsync
in interface RObjectAsync
sizeInMemoryAsync
in class RedissonObject
public RFuture<Boolean> deleteAsync()
RObjectAsync
deleteAsync
in interface RObjectAsync
deleteAsync
in class RedissonObject
true
if object was deleted false
if notpublic RFuture<Map<K,V>> getAllAsync(Set<K> keys)
RMapAsync
keys
.
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)
RMapAsync
value
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<Collection<V>> readAllValuesAsync()
RMapAsync
readAllValuesAsync
in interface RMapAsync<K,V>
readAllValuesAsync
in class RedissonMap<K,V>
public RFuture<Map<K,V>> readAllMapAsync()
RMapAsync
readAllMapAsync
in interface RMapAsync<K,V>
readAllMapAsync
in class RedissonMap<K,V>
public void preloadCache()
RLocalCachedMap
preloadCache
in interface RLocalCachedMap<K,V>
public void preloadCache(int count)
RLocalCachedMap
count
param.preloadCache
in interface RLocalCachedMap<K,V>
count
- - size of batchpublic void clearLocalCache()
RLocalCachedMap
clearLocalCache
in interface RLocalCachedMap<K,V>
public RFuture<Void> clearLocalCacheAsync()
RLocalCachedMap
clearLocalCacheAsync
in interface RLocalCachedMap<K,V>
public RFuture<Set<Map.Entry<K,V>>> readAllEntrySetAsync()
RMapAsync
readAllEntrySetAsync
in interface RMapAsync<K,V>
readAllEntrySetAsync
in class RedissonMap<K,V>
public RFuture<Boolean> fastReplaceAsync(K key, V value)
RMapAsync
value
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)
RMapAsync
value
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 value
is 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)
RMapAsync
oldValue
with a newValue
mapped by specified key
.
Returns false
if previous value doesn't exist or equal to oldValue
.
If MapWriter
is defined then newValue
is 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)
RMapAsync
key
and value
.
If MapWriter
is defined then key
is 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> putIfAbsentAsync(K key, V value)
RMapAsync
value
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 RedissonObject
public Set<K> cachedKeySet()
RLocalCachedMap
cachedKeySet
in interface RLocalCachedMap<K,V>
public Collection<V> cachedValues()
RLocalCachedMap
cachedValues
in interface RLocalCachedMap<K,V>
public Set<Map.Entry<K,V>> cachedEntrySet()
RLocalCachedMap
cachedEntrySet
in interface RLocalCachedMap<K,V>
public Map<K,V> getCachedMap()
RLocalCachedMap
getCachedMap
in interface RLocalCachedMap<K,V>
public boolean expire(long timeToLive, TimeUnit timeUnit)
RExpirable
expire
in interface RExpirable
timeToLive
- - 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)
RExpirableAsync
expireAsync
in interface RExpirableAsync
timeToLive
- - timeout before object will be deletedtimeUnit
- - timeout time unittrue
if the timeout was set and false
if notpublic boolean expireAt(long timestamp)
RExpirable
expireAt
in interface RExpirable
timestamp
- - expire date in milliseconds (Unix timestamp)true
if the timeout was set and false
if notpublic RFuture<Boolean> expireAtAsync(long timestamp)
RExpirableAsync
expireAtAsync
in interface RExpirableAsync
timestamp
- - expire date in milliseconds (Unix timestamp)true
if the timeout was set and false
if notpublic boolean expireAt(Date timestamp)
RExpirable
expireAt
in interface RExpirable
timestamp
- - expire datetrue
if the timeout was set and false
if notpublic RFuture<Boolean> expireAtAsync(Date timestamp)
RExpirableAsync
expireAtAsync
in interface RExpirableAsync
timestamp
- - expire datetrue
if the timeout was set and false
if notpublic boolean clearExpire()
RExpirable
clearExpire
in interface RExpirable
true
if timeout was removed
false
if object does not exist or does not have an associated timeoutpublic RFuture<Boolean> clearExpireAsync()
RExpirableAsync
clearExpireAsync
in interface RExpirableAsync
true
if the timeout was cleared and false
if notpublic long remainTimeToLive()
RExpirable
remainTimeToLive
in interface RExpirable
public RFuture<Long> remainTimeToLiveAsync()
RExpirableAsync
remainTimeToLiveAsync
in interface RExpirableAsync
protected RFuture<Boolean> expireAsync(long timeToLive, TimeUnit timeUnit, String... keys)
Copyright © 2014–2020 Redisson. All rights reserved.