K - keyV - valuepublic class RedissonMapCache<K,V> extends RedissonMap<K,V> implements RMapCache<K,V>
Map-based cache with ability to set TTL for each entry via
put(Object, Object, long, TimeUnit) or putIfAbsent(Object, Object, long, TimeUnit) methods.
And therefore has an complex lua-scripts inside.
Current redis implementation doesnt have map entry eviction functionality.
Thus entries are checked for TTL expiration during any key/value/entry read operation.
If key/value/entry expired then it doesn't returns and clean task runs asynchronous.
Clean task deletes removes 100 expired entries at once.
In addition there is EvictionScheduler. This scheduler
deletes expired entries in time interval between 5 seconds to 2 hours.
If eviction is not required then it's better to use RedissonMap object.
codec, commandExecutor, name| Constructor and Description |
|---|
RedissonMapCache(Codec codec,
EvictionScheduler evictionScheduler,
CommandAsyncExecutor commandExecutor,
String name,
RedissonClient redisson,
MapOptions<K,V> options,
WriteBehindService writeBehindService) |
RedissonMapCache(EvictionScheduler evictionScheduler,
CommandAsyncExecutor commandExecutor,
String name,
RedissonClient redisson,
MapOptions<K,V> options,
WriteBehindService writeBehindService) |
| Modifier and Type | Method and Description |
|---|---|
V |
addAndGet(K key,
Number value)
Adds the given
delta to the current value
by mapped key. |
protected RFuture<V> |
addAndGetOperationAsync(K key,
Number value) |
int |
addListener(MapEntryListener listener)
Adds map entry listener
|
void |
clear() |
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) |
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 |
RFuture<Boolean> |
deleteAsync()
Delete object in async mode
|
void |
destroy()
Destroys object when it's not necessary anymore.
|
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) |
boolean |
fastPut(K key,
V value,
long ttl,
TimeUnit ttlUnit)
Stores value mapped by key with specified time to live.
|
boolean |
fastPut(K key,
V value,
long ttl,
TimeUnit ttlUnit,
long maxIdleTime,
TimeUnit maxIdleUnit)
Stores value mapped by key with specified time to live and max idle time.
|
RFuture<Boolean> |
fastPutAsync(K key,
V value,
long ttl,
TimeUnit ttlUnit)
Stores value mapped by key with specified time to live.
|
RFuture<Boolean> |
fastPutAsync(K key,
V value,
long ttl,
TimeUnit ttlUnit,
long maxIdleTime,
TimeUnit maxIdleUnit)
Stores value mapped by key with specified time to live and max idle time.
|
boolean |
fastPutIfAbsent(K key,
V value,
long ttl,
TimeUnit ttlUnit)
If the specified key is not already associated
with a value, associate it with the given value.
|
boolean |
fastPutIfAbsent(K key,
V value,
long ttl,
TimeUnit ttlUnit,
long maxIdleTime,
TimeUnit maxIdleUnit)
If the specified key is not already associated
with a value, associate it with the given value.
|
RFuture<Boolean> |
fastPutIfAbsentAsync(K key,
V value,
long ttl,
TimeUnit ttlUnit,
long maxIdleTime,
TimeUnit maxIdleUnit)
If the specified key is not already associated
with a value, associate it with the given value.
|
protected RFuture<Boolean> |
fastPutIfAbsentOperationAsync(K key,
V value) |
protected RFuture<Boolean> |
fastPutIfExistsOperationAsync(K key,
V value) |
protected RFuture<Boolean> |
fastPutOperationAsync(K key,
V value) |
protected RFuture<Boolean> |
fastPutOperationAsync(K key,
V value,
long ttl,
TimeUnit ttlUnit,
long maxIdleTime,
TimeUnit maxIdleUnit) |
protected RFuture<Long> |
fastRemoveOperationAsync(K... keys) |
protected RFuture<List<Long>> |
fastRemoveOperationBatchAsync(K... keys) |
protected RFuture<Boolean> |
fastReplaceOperationAsync(K key,
V value) |
RFuture<Map<K,V>> |
getAllOperationAsync(Set<K> keys) |
RFuture<V> |
getOperationAsync(K key) |
V |
getWithTTLOnly(K key)
Returns the value mapped by defined
key or null if value is absent. |
RFuture<V> |
getWithTTLOnlyAsync(K key)
Returns the value mapped by defined
key or null if value is absent. |
V |
put(K key,
V value,
long ttl,
TimeUnit unit)
Stores value mapped by key with specified time to live.
|
V |
put(K key,
V value,
long ttl,
TimeUnit ttlUnit,
long maxIdleTime,
TimeUnit maxIdleUnit)
Stores value mapped by key with specified time to live and max idle time.
|
void |
putAll(Map<? extends K,? extends V> map,
long ttl,
TimeUnit ttlUnit)
Associates the specified
value with the specified key
in batch. |
RFuture<Void> |
putAllAsync(Map<? extends K,? extends V> map,
long ttl,
TimeUnit ttlUnit)
Associates the specified
value with the specified key
in batch. |
protected RFuture<Void> |
putAllOperationAsync(Map<? extends K,? extends V> map) |
RFuture<V> |
putAsync(K key,
V value,
long ttl,
TimeUnit ttlUnit)
Stores value mapped by key with specified time to live.
|
RFuture<V> |
putAsync(K key,
V value,
long ttl,
TimeUnit ttlUnit,
long maxIdleTime,
TimeUnit maxIdleUnit)
Stores value mapped by key with specified time to live and max idle time.
|
V |
putIfAbsent(K key,
V value,
long ttl,
TimeUnit ttlUnit)
If the specified key is not already associated
with a value, associate it with the given value.
|
V |
putIfAbsent(K key,
V value,
long ttl,
TimeUnit ttlUnit,
long maxIdleTime,
TimeUnit maxIdleUnit)
If the specified key is not already associated
with a value, associate it with the given value.
|
RFuture<V> |
putIfAbsentAsync(K key,
V value,
long ttl,
TimeUnit ttlUnit)
If the specified key is not already associated
with a value, associate it with the given value.
|
RFuture<V> |
putIfAbsentAsync(K key,
V value,
long ttl,
TimeUnit ttlUnit,
long maxIdleTime,
TimeUnit maxIdleUnit)
If the specified key is not already associated
with a value, associate it with the given value.
|
protected RFuture<V> |
putIfAbsentOperationAsync(K key,
V value) |
protected RFuture<V> |
putIfExistsOperationAsync(K key,
V value) |
protected RFuture<V> |
putOperationAsync(K key,
V value) |
protected RFuture<V> |
putOperationAsync(K key,
V value,
long ttlTimeout,
long maxIdleTimeout,
long maxIdleDelta,
long ttlTimeoutDelta) |
RFuture<Map<K,V>> |
randomEntriesAsync(int count)
Returns random map entries from this map limited by
count |
RFuture<Set<K>> |
randomKeysAsync(int count)
Returns random keys from this map limited by
count |
RFuture<Set<Map.Entry<K,V>>> |
readAllEntrySetAsync()
Read all map entries at once
|
RFuture<Set<K>> |
readAllKeySetAsync()
Read all keys 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
|
long |
remainTimeToLive(K key)
Remaining time to live of map entry associated with a
key. |
RFuture<Long> |
remainTimeToLiveAsync()
Remaining time to live of Redisson object that has a timeout
|
RFuture<Long> |
remainTimeToLiveAsync(K key)
Remaining time to live of map entry associated with a
key. |
void |
removeListener(int listenerId)
Removes object event listener
|
protected RFuture<V> |
removeOperationAsync(K key) |
protected RFuture<Boolean> |
removeOperationAsync(Object key,
Object value) |
protected RFuture<V> |
replaceOperationAsync(K key,
V value) |
protected RFuture<Boolean> |
replaceOperationAsync(K key,
V oldValue,
V newValue) |
MapScanResult<Object,Object> |
scanIterator(String name,
RedisClient client,
long startPos,
String pattern,
int count) |
RFuture<MapScanResult<Object,Object>> |
scanIteratorAsync(String name,
RedisClient client,
long startPos,
String pattern,
int count) |
void |
setMaxSize(int maxSize)
Sets max size of the map and overrides current value.
|
void |
setMaxSize(int maxSize,
EvictionMode mode)
Sets max size of the map and overrides current value.
|
RFuture<Void> |
setMaxSizeAsync(int maxSize)
Sets max size of the map and overrides current value.
|
RFuture<Void> |
setMaxSizeAsync(int maxSize,
EvictionMode mode)
Sets max size of the map and overrides current value.
|
RFuture<Long> |
sizeInMemoryAsync()
Returns bytes amount used by object in Redis memory.
|
boolean |
trySetMaxSize(int maxSize)
Tries to set max size of the map.
|
boolean |
trySetMaxSize(int maxSize,
EvictionMode mode)
Tries to set max size of the map.
|
RFuture<Boolean> |
trySetMaxSizeAsync(int maxSize)
Tries to set max size of the map.
|
RFuture<Boolean> |
trySetMaxSizeAsync(int maxSize,
EvictionMode mode)
Tries to set max size of the map.
|
boolean |
updateEntryExpiration(K key,
long ttl,
TimeUnit ttlUnit,
long maxIdleTime,
TimeUnit maxIdleUnit)
Updates time to live and max idle time of specified entry by key.
|
RFuture<Boolean> |
updateEntryExpirationAsync(K key,
long ttl,
TimeUnit ttlUnit,
long maxIdleTime,
TimeUnit maxIdleUnit)
Updates time to live and max idle time of specified entry by key.
|
addAndGetAsync, checkKey, checkValue, compute, computeAsync, computeIfAbsent, computeIfAbsentAsync, computeIfPresent, computeIfPresentAsync, containsKey, containsValue, entryIterator, entrySet, entrySet, entrySet, entrySet, equals, fastPut, fastPutAsync, fastPutIfAbsent, fastPutIfAbsentAsync, fastPutIfExists, fastPutIfExistsAsync, fastRemove, fastRemoveAsync, fastReplace, fastReplaceAsync, get, getAll, getAllAsync, getAsync, getCountDownLatch, getFairLock, getLock, 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, putIfAbsentAsync, putIfExists, putIfExistsAsync, randomEntries, randomKeys, readAllEntrySet, readAllKeySet, readAllMap, readAllValues, remove, remove, removeAsync, removeAsync, replace, replace, replaceAsync, replaceAsync, size, sizeAsync, valueIterator, values, values, values, values, valueSize, valueSizeAsyncaddListener, addListener, addListenerAsync, addListenerAsync, copy, copyAsync, delete, deleteAsync, dump, dumpAsync, encode, encode, encode, encode, encodeMapKey, encodeMapKeys, encodeMapValue, encodeMapValues, get, getCodec, getIdleTime, getIdleTimeAsync, getLockByMapKey, getLockByValue, getName, getRawName, getRawName, isExists, isExistsAsync, migrate, migrateAsync, move, moveAsync, prefixName, 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, waitcontainsKey, 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, rename, renamenx, restore, restore, restoreAndReplace, restoreAndReplace, sizeInMemory, touch, unlinksizeAsyncaddAndGetAsync, computeAsync, computeIfAbsentAsync, computeIfPresentAsync, fastPutAsync, fastPutIfAbsentAsync, fastPutIfExistsAsync, fastRemoveAsync, fastReplaceAsync, getAllAsync, getAsync, loadAllAsync, loadAllAsync, mergeAsync, putAllAsync, putAllAsync, putAsync, putIfAbsentAsync, putIfExistsAsync, removeAsync, removeAsync, replaceAsync, replaceAsync, valueSizeAsyncexpireAsync, expireAtAsync, remainTimeToLiveAsyncaddListenerAsync, copyAsync, dumpAsync, getIdleTimeAsync, isExistsAsync, migrateAsync, moveAsync, removeListenerAsync, renameAsync, renamenxAsync, restoreAndReplaceAsync, restoreAndReplaceAsync, restoreAsync, restoreAsync, touchAsync, unlinkAsyncpublic RedissonMapCache(EvictionScheduler evictionScheduler, CommandAsyncExecutor commandExecutor, String name, RedissonClient redisson, MapOptions<K,V> options, WriteBehindService writeBehindService)
public RedissonMapCache(Codec codec, EvictionScheduler evictionScheduler, CommandAsyncExecutor commandExecutor, String name, RedissonClient redisson, MapOptions<K,V> options, WriteBehindService writeBehindService)
public boolean trySetMaxSize(int maxSize)
RMapCachetrySetMaxSize in interface RMapCache<K,V>maxSize - - max sizetrue if max size has been successfully set, otherwise false.
If 0 the cache is unbounded (default).public boolean trySetMaxSize(int maxSize,
EvictionMode mode)
RMapCachetrySetMaxSize in interface RMapCache<K,V>maxSize - - max sizemode - - eviction modetrue if max size has been successfully set, otherwise false.public RFuture<Boolean> trySetMaxSizeAsync(int maxSize)
RMapCacheAsynctrySetMaxSizeAsync in interface RMapCacheAsync<K,V>maxSize - - max sizetrue if max size has been successfully set, otherwise false.public RFuture<Boolean> trySetMaxSizeAsync(int maxSize, EvictionMode mode)
RMapCacheAsynctrySetMaxSizeAsync in interface RMapCacheAsync<K,V>maxSize - - max sizemode - - eviction modetrue if max size has been successfully set, otherwise false.public void setMaxSize(int maxSize)
RMapCachesetMaxSize in interface RMapCache<K,V>maxSize - - max size
If 0 the cache is unbounded (default).public void setMaxSize(int maxSize,
EvictionMode mode)
RMapCachesetMaxSize in interface RMapCache<K,V>maxSize - - max sizemode - - eviction modepublic RFuture<Void> setMaxSizeAsync(int maxSize)
RMapCacheAsyncsetMaxSizeAsync in interface RMapCacheAsync<K,V>maxSize - - max sizepublic RFuture<Void> setMaxSizeAsync(int maxSize, EvictionMode mode)
RMapCacheAsyncsetMaxSizeAsync in interface RMapCacheAsync<K,V>maxSize - - max sizemode - - eviction modepublic 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<Map<K,V>> getAllOperationAsync(Set<K> keys)
getAllOperationAsync in class RedissonMap<K,V>public V putIfAbsent(K key, V value, long ttl, TimeUnit ttlUnit)
RMapCacheStores value mapped by key with specified time to live. Entry expires after specified time to live.
putIfAbsent in interface RMapCache<K,V>key - - map keyvalue - - map valuettl - - time to live for key\value entry.
If 0 then stores infinitely.ttlUnit - - time unitpublic RFuture<V> putIfAbsentAsync(K key, V value, long ttl, TimeUnit ttlUnit)
RMapCacheAsyncStores value mapped by key with specified time to live. Entry expires after specified time to live. If the map previously contained a mapping for the key, the old value is replaced by the specified value.
putIfAbsentAsync in interface RMapCacheAsync<K,V>key - - map keyvalue - - map valuettl - - time to live for key\value entry.
If 0 then stores infinitely.ttlUnit - - time unitpublic V putIfAbsent(K key, V value, long ttl, TimeUnit ttlUnit, long maxIdleTime, TimeUnit maxIdleUnit)
RMapCacheStores value mapped by key with specified time to live and max idle time. Entry expires when specified time to live or max idle time has expired.
putIfAbsent in interface RMapCache<K,V>key - - map keyvalue - - map valuettl - - time to live for key\value entry.
If 0 then time to live doesn't affect entry expiration.ttlUnit - - time unitmaxIdleTime - - max idle time for key\value entry.
If 0 then max idle time doesn't affect entry expiration.maxIdleUnit - - time unit
if maxIdleTime and ttl params are equal to 0
then entry stores infinitely.
public RFuture<V> putIfAbsentAsync(K key, V value, long ttl, TimeUnit ttlUnit, long maxIdleTime, TimeUnit maxIdleUnit)
RMapCacheAsyncStores value mapped by key with specified time to live and max idle time. Entry expires when specified time to live or max idle time has expired.
If the map previously contained a mapping for the key, the old value is replaced by the specified value.
putIfAbsentAsync in interface RMapCacheAsync<K,V>key - - map keyvalue - - map valuettl - - time to live for key\value entry.
If 0 then time to live doesn't affect entry expiration.ttlUnit - - time unitmaxIdleTime - - max idle time for key\value entry.
If 0 then max idle time doesn't affect entry expiration.maxIdleUnit - - time unit
if maxIdleTime and ttl params are equal to 0
then entry stores infinitely.
protected RFuture<Boolean> removeOperationAsync(Object key, Object value)
removeOperationAsync in class RedissonMap<K,V>public RFuture<V> getOperationAsync(K key)
getOperationAsync in class RedissonMap<K,V>public V put(K key, V value, long ttl, TimeUnit unit)
RMapCacheIf the map previously contained a mapping for the key, the old value is replaced by the specified value.
protected RFuture<V> putOperationAsync(K key, V value)
putOperationAsync in class RedissonMap<K,V>protected RFuture<V> putIfExistsOperationAsync(K key, V value)
putIfExistsOperationAsync in class RedissonMap<K,V>protected RFuture<V> putIfAbsentOperationAsync(K key, V value)
putIfAbsentOperationAsync in class RedissonMap<K,V>public void putAll(Map<? extends K,? extends V> map, long ttl, TimeUnit ttlUnit)
RMapCachevalue with the specified key
in batch.
If MapWriter is defined then new map entries will be stored in write-through mode.
public RFuture<Void> putAllAsync(Map<? extends K,? extends V> map, long ttl, TimeUnit ttlUnit)
RMapCacheAsyncvalue with the specified key
in batch.
If MapWriter is defined then new map entries are stored in write-through mode.
putAllAsync in interface RMapCacheAsync<K,V>map - - mappings to be stored in this mapttl - - time to live for all key\value entries.
If 0 then stores infinitely.ttlUnit - - time unitpublic V addAndGet(K key, Number value)
RMapdelta to the current value
by mapped key.
Works only for numeric values!protected RFuture<V> addAndGetOperationAsync(K key, Number value)
addAndGetOperationAsync in class RedissonMap<K,V>public boolean fastPut(K key, V value, long ttl, TimeUnit ttlUnit)
RMapCacheIf the map previously contained a mapping for the key, the old value is replaced by the specified value.
Works faster than usual RMapCache.put(Object, Object, long, TimeUnit)
as it not returns previous value.
fastPut in interface RMapCache<K,V>key - - map keyvalue - - map valuettl - - time to live for key\value entry.
If 0 then stores infinitely.ttlUnit - - time unittrue if key is a new key in the hash and value was set.
false if key already exists in the hash and the value was updated.public RFuture<Boolean> fastPutAsync(K key, V value, long ttl, TimeUnit ttlUnit)
RMapCacheAsyncIf the map previously contained a mapping for the key, the old value is replaced by the specified value.
Works faster than usual RMapCacheAsync.putAsync(Object, Object, long, TimeUnit)
as it not returns previous value.
fastPutAsync in interface RMapCacheAsync<K,V>key - - map keyvalue - - map valuettl - - time to live for key\value entry.
If 0 then stores infinitely.ttlUnit - - time unittrue if key is a new key in the hash and value was set.
false if key already exists in the hash and the value was updated.public boolean fastPut(K key, V value, long ttl, TimeUnit ttlUnit, long maxIdleTime, TimeUnit maxIdleUnit)
RMapCacheIf the map previously contained a mapping for the key, the old value is replaced by the specified value.
Works faster than usual RMapCache.put(Object, Object, long, TimeUnit, long, TimeUnit)
as it not returns previous value.
fastPut in interface RMapCache<K,V>key - - map keyvalue - - map valuettl - - time to live for key\value entry.
If 0 then time to live doesn't affect entry expiration.ttlUnit - - time unitmaxIdleTime - - max idle time for key\value entry.
If 0 then max idle time doesn't affect entry expiration.maxIdleUnit - - time unit
if maxIdleTime and ttl params are equal to 0
then entry stores infinitely.
true if key is a new key in the hash and value was set.
false if key already exists in the hash and the value was updated.public RFuture<Boolean> fastPutAsync(K key, V value, long ttl, TimeUnit ttlUnit, long maxIdleTime, TimeUnit maxIdleUnit)
RMapCacheAsyncIf the map previously contained a mapping for the key, the old value is replaced by the specified value.
Works faster than usual RMapCacheAsync.putAsync(Object, Object, long, TimeUnit, long, TimeUnit)
as it not returns previous value.
fastPutAsync in interface RMapCacheAsync<K,V>key - - map keyvalue - - map valuettl - - time to live for key\value entry.
If 0 then time to live doesn't affect entry expiration.ttlUnit - - time unitmaxIdleTime - - max idle time for key\value entry.
If 0 then max idle time doesn't affect entry expiration.maxIdleUnit - - time unit
if maxIdleTime and ttl params are equal to 0
then entry stores infinitely.
true if key is a new key in the hash and value was set.
false if key already exists in the hash and the value was updated.protected RFuture<Boolean> fastPutOperationAsync(K key, V value, long ttl, TimeUnit ttlUnit, long maxIdleTime, TimeUnit maxIdleUnit)
public boolean updateEntryExpiration(K key, long ttl, TimeUnit ttlUnit, long maxIdleTime, TimeUnit maxIdleUnit)
RMapCache
Returns false if entry already expired or doesn't exist,
otherwise returns true.
updateEntryExpiration in interface RMapCache<K,V>key - - map keyttl - - time to live for key\value entry.
If 0 then time to live doesn't affect entry expiration.ttlUnit - - time unitmaxIdleTime - - max idle time for key\value entry.
If 0 then max idle time doesn't affect entry expiration.maxIdleUnit - - time unit
if maxIdleTime and ttl params are equal to 0
then entry stores infinitely.
false if entry already expired or doesn't exist,
otherwise returns true.public RFuture<Boolean> updateEntryExpirationAsync(K key, long ttl, TimeUnit ttlUnit, long maxIdleTime, TimeUnit maxIdleUnit)
RMapCacheAsync
Returns false if entry already expired or doesn't exist,
otherwise returns true.
updateEntryExpirationAsync in interface RMapCacheAsync<K,V>key - - map keyttl - - time to live for key\value entry.
If 0 then time to live doesn't affect entry expiration.ttlUnit - - time unitmaxIdleTime - - max idle time for key\value entry.
If 0 then max idle time doesn't affect entry expiration.maxIdleUnit - - time unit
if maxIdleTime and ttl params are equal to 0
then entry stores infinitely.
false if entry already expired or doesn't exist,
otherwise returns true.public RFuture<V> putAsync(K key, V value, long ttl, TimeUnit ttlUnit)
RMapCacheAsyncputAsync in interface RMapCacheAsync<K,V>key - - map keyvalue - - map valuettl - - time to live for key\value entry.
If 0 then stores infinitely.ttlUnit - - time unitpublic V put(K key, V value, long ttl, TimeUnit ttlUnit, long maxIdleTime, TimeUnit maxIdleUnit)
RMapCacheIf the map previously contained a mapping for the key, the old value is replaced by the specified value.
put in interface RMapCache<K,V>key - - map keyvalue - - map valuettl - - time to live for key\value entry.
If 0 then time to live doesn't affect entry expiration.ttlUnit - - time unitmaxIdleTime - - max idle time for key\value entry.
If 0 then max idle time doesn't affect entry expiration.maxIdleUnit - - time unit
if maxIdleTime and ttl params are equal to 0
then entry stores infinitely.
public RFuture<V> putAsync(K key, V value, long ttl, TimeUnit ttlUnit, long maxIdleTime, TimeUnit maxIdleUnit)
RMapCacheAsyncIf the map previously contained a mapping for the key, the old value is replaced by the specified value.
putAsync in interface RMapCacheAsync<K,V>key - - map keyvalue - - map valuettl - - time to live for key\value entry.
If 0 then time to live doesn't affect entry expiration.ttlUnit - - time unitmaxIdleTime - - max idle time for key\value entry.
If 0 then max idle time doesn't affect entry expiration.maxIdleUnit - - time unit
if maxIdleTime and ttl params are equal to 0
then entry stores infinitely.
protected RFuture<V> putOperationAsync(K key, V value, long ttlTimeout, long maxIdleTimeout, long maxIdleDelta, long ttlTimeoutDelta)
public V getWithTTLOnly(K key)
RMapCachekey 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.
Idle time of entry is not taken into account. Entry last access time isn't modified if map limited by size.
getWithTTLOnly in interface RMapCache<K,V>key - the keykey or null if value is absentpublic RFuture<V> getWithTTLOnlyAsync(K key)
RMapCacheAsynckey 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.
Idle time of entry is not taken into account. Entry last access time isn't modified if map limited by size.
getWithTTLOnlyAsync in interface RMapCacheAsync<K,V>key - the keykey or null if value is absentpublic long remainTimeToLive(K key)
RMapCachekey.remainTimeToLive in interface RMapCache<K,V>key - - map keypublic RFuture<Long> remainTimeToLiveAsync(K key)
RMapCacheAsynckey.remainTimeToLiveAsync in interface RMapCacheAsync<K,V>key - - map keyprotected 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 MapScanResult<Object,Object> scanIterator(String name, RedisClient client, long startPos, String pattern, int count)
scanIterator in class RedissonMap<K,V>public RFuture<MapScanResult<Object,Object>> scanIteratorAsync(String name, RedisClient client, long startPos, String pattern, int count)
scanIteratorAsync in class RedissonMap<K,V>protected RFuture<Boolean> fastPutOperationAsync(K key, V value)
fastPutOperationAsync in class RedissonMap<K,V>protected RFuture<Boolean> fastPutIfExistsOperationAsync(K key, V value)
fastPutIfExistsOperationAsync in class RedissonMap<K,V>protected RFuture<Boolean> fastPutIfAbsentOperationAsync(K key, V value)
fastPutIfAbsentOperationAsync in class RedissonMap<K,V>public boolean fastPutIfAbsent(K key, V value, long ttl, TimeUnit ttlUnit)
RMapCacheStores value mapped by key with specified time to live. Entry expires after specified time to live.
Works faster than usual RMapCache.putIfAbsent(Object, Object, long, TimeUnit)
as it not returns previous value.
fastPutIfAbsent in interface RMapCache<K,V>key - - map keyvalue - - map valuettl - - time to live for key\value entry.
If 0 then stores infinitely.ttlUnit - - time unittrue if key is a new key in the hash and value was set.
false if key already exists in the hashpublic boolean fastPutIfAbsent(K key, V value, long ttl, TimeUnit ttlUnit, long maxIdleTime, TimeUnit maxIdleUnit)
RMapCacheStores value mapped by key with specified time to live and max idle time. Entry expires when specified time to live or max idle time has expired.
Works faster than usual RMapCache.putIfAbsent(Object, Object, long, TimeUnit, long, TimeUnit)
as it not returns previous value.
fastPutIfAbsent in interface RMapCache<K,V>key - - map keyvalue - - map valuettl - - time to live for key\value entry.
If 0 then time to live doesn't affect entry expiration.ttlUnit - - time unitmaxIdleTime - - max idle time for key\value entry.
If 0 then max idle time doesn't affect entry expiration.maxIdleUnit - - time unit
if maxIdleTime and ttl params are equal to 0
then entry stores infinitely.
true if key is a new key in the hash and value was set.
false if key already exists in the hash.public RFuture<Boolean> fastPutIfAbsentAsync(K key, V value, long ttl, TimeUnit ttlUnit, long maxIdleTime, TimeUnit maxIdleUnit)
RMapCacheAsyncStores value mapped by key with specified time to live and max idle time. Entry expires when specified time to live or max idle time has expired.
Works faster than usual RMapCacheAsync.putIfAbsentAsync(Object, Object, long, TimeUnit, long, TimeUnit)
as it not returns previous value.
fastPutIfAbsentAsync in interface RMapCacheAsync<K,V>key - - map keyvalue - - map valuettl - - time to live for key\value entry.
If 0 then time to live doesn't affect entry expiration.ttlUnit - - time unitmaxIdleTime - - max idle time for key\value entry.
If 0 then max idle time doesn't affect entry expiration.maxIdleUnit - - time unit
if maxIdleTime and ttl params are equal to 0
then entry stores infinitely.
true if key is a new key in the hash and value was set.
false if key already exists in the hashprotected RFuture<Boolean> replaceOperationAsync(K key, V oldValue, V newValue)
replaceOperationAsync in class RedissonMap<K,V>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>protected RFuture<Void> putAllOperationAsync(Map<? extends K,? extends V> map)
putAllOperationAsync in class RedissonMap<K,V>public int addListener(MapEntryListener listener)
RMapCacheaddListener in interface RMapCache<K,V>listener - - entry listenerEntryCreatedListener,
EntryUpdatedListener,
EntryRemovedListener,
EntryExpiredListenerpublic void removeListener(int listenerId)
RObjectremoveListener in interface RMapCache<K,V>removeListener in interface RObjectremoveListener in class RedissonObjectlistenerId - - listener idpublic RFuture<Long> sizeInMemoryAsync()
RObjectAsyncsizeInMemoryAsync in interface RObjectAsyncsizeInMemoryAsync in class RedissonObjectpublic void clear()
public RFuture<Boolean> deleteAsync()
RObjectAsyncdeleteAsync in interface RObjectAsyncdeleteAsync in class RedissonObjecttrue if object was deleted 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 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 RFuture<Boolean> clearExpireAsync()
RExpirableAsyncclearExpireAsync in interface RExpirableAsynctrue if the timeout was cleared and false if notpublic RFuture<Set<K>> readAllKeySetAsync()
RMapAsyncreadAllKeySetAsync in interface RMapAsync<K,V>readAllKeySetAsync in class RedissonMap<K,V>public RFuture<Set<K>> randomKeysAsync(int count)
RMapAsynccountrandomKeysAsync in interface RMapAsync<K,V>randomKeysAsync in class RedissonMap<K,V>count - - keys amount to returnpublic RFuture<Map<K,V>> randomEntriesAsync(int count)
RMapAsynccountrandomEntriesAsync in interface RMapAsync<K,V>randomEntriesAsync in class RedissonMap<K,V>count - - entries amount to returnpublic RFuture<Set<Map.Entry<K,V>>> readAllEntrySetAsync()
RMapAsyncreadAllEntrySetAsync in interface RMapAsync<K,V>readAllEntrySetAsync in class RedissonMap<K,V>public RFuture<Map<K,V>> readAllMapAsync()
RMapAsyncreadAllMapAsync in interface RMapAsync<K,V>readAllMapAsync in class RedissonMap<K,V>public RFuture<Collection<V>> readAllValuesAsync()
RMapAsyncreadAllValuesAsync in interface RMapAsync<K,V>readAllValuesAsync in class RedissonMap<K,V>public void destroy()
RDestroyabledestroy in interface RDestroyablepublic 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 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 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 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.