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) |
RFuture<Long> |
sizeInMemoryAsync()
Returns size of 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, getLockName, getOperationAsync, getPermitExpirableSemaphore, getReadWriteLock, getSemaphore, hashCode, hasNoLoader, hasNoWriter, isEmpty, keyIterator, keySet, keySet, keySet, keySet, loadAll, loadAll, loadAllAsync, loadAllAsync, mapReduce, mapWriterFuture, put, putAll, putAll, putAllAsync, putAllAsync, putAsync, putIfAbsent, putIfAbsentOperationAsync, readAllEntrySet, readAllKeySet, readAllKeySetAsync, readAllMap, readAllValues, remove, remove, removeAsync, replace, replace, scanIterator, scanIteratorAsync, size, sizeAsync, valueIterator, values, values, values, values, valueSize, valueSizeAsync
await, copy, copyAsync, delete, dump, dumpAsync, encode, encode, encodeMapKey, encodeMapKeys, encodeMapValue, encodeMapValues, get, getCodec, getName, getName, isExists, isExistsAsync, migrate, migrateAsync, move, moveAsync, prefixName, rename, renameAsync, renamenx, renamenxAsync, restore, restore, restoreAndReplace, restoreAndReplace, restoreAndReplaceAsync, restoreAndReplaceAsync, restoreAsync, restoreAsync, sizeInMemory, sizeInMemoryAsync, suffixName, toSeconds, touch, touchAsync, unlink, unlinkAsync
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
addAndGet, 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
clear, containsKey, containsValue, equals, hashCode, isEmpty, size
clearExpire, expire, expireAt, expireAt, remainTimeToLive
copy, delete, dump, getCodec, getName, isExists, migrate, move, rename, renamenx, restore, restore, restoreAndReplace, restoreAndReplace, sizeInMemory, touch, unlink
addAndGetAsync, fastPutAsync, fastRemoveAsync, loadAllAsync, loadAllAsync, putAllAsync, putAllAsync, putAsync, readAllKeySetAsync, removeAsync, sizeAsync, valueSizeAsync
clearExpireAsync, expireAsync, expireAtAsync, expireAtAsync, remainTimeToLiveAsync
copyAsync, dumpAsync, isExistsAsync, migrateAsync, moveAsync, 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)
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)
RMapAsync
null
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()
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
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)
RMapAsync
value
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()
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 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
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)
RMapAsync
value
associated with the key
.
If there wasn't any association before then method returns null
.
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 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)
RMapAsync
oldValue
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 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
from map only if it associated with 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 replaced otherwise false
.public RFuture<V> putIfAbsentAsync(K key, V value)
RMapAsync
value
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 RedissonObject
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
Copyright © 2014–2018 The Redisson Project. All rights reserved.