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
Constructor and Description |
---|
RedissonMapCache(Codec codec,
EvictionScheduler evictionScheduler,
CommandAsyncExecutor commandExecutor,
String name,
RedissonClient redisson,
MapOptions<K,V> options) |
RedissonMapCache(EvictionScheduler evictionScheduler,
CommandAsyncExecutor commandExecutor,
String name,
RedissonClient redisson,
MapOptions<K,V> options) |
Modifier and Type | Method and Description |
---|---|
V |
addAndGet(K key,
Number value)
Atomically 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
|
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.
|
RFuture<Boolean> |
containsKeyAsync(Object key) |
RFuture<Boolean> |
containsValueAsync(Object value) |
RFuture<Boolean> |
deleteAsync()
Delete object in async mode
|
void |
destroy()
Destroys object when it's not necessary anymore.
|
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.
|
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> |
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 |
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> |
putOperationAsync(K key,
V value) |
protected RFuture<V> |
putOperationAsync(K key,
V value,
long ttlTimeout,
long maxIdleTimeout,
long maxIdleDelta) |
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 map entry 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.
|
RFuture<Void> |
setMaxSizeAsync(int maxSize)
Sets max size of the map.
|
RFuture<Long> |
sizeInMemoryAsync()
Returns size of object in Redis memory
|
boolean |
trySetMaxSize(int maxSize)
Tries to set max size of the map.
|
RFuture<Boolean> |
trySetMaxSizeAsync(int maxSize)
Tries to set max size of the map.
|
addAndGetAsync, checkKey, checkValue, clear, containsKey, containsValue, entryIterator, entrySet, entrySet, entrySet, entrySet, equals, fastPut, fastPutAsync, fastPutIfAbsent, fastPutIfAbsentAsync, fastRemove, fastRemoveAsync, fastReplace, fastReplaceAsync, get, getAll, getAllAsync, getAsync, getCountDownLatch, getFairLock, getLock, getLockName, 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, putIfAbsentAsync, readAllEntrySet, readAllKeySet, readAllMap, readAllValues, remove, remove, removeAsync, removeAsync, replace, replace, replaceAsync, replaceAsync, size, sizeAsync, valueIterator, values, values, values, values, valueSize, valueSizeAsync
await, copy, copyAsync, delete, dump, dumpAsync, encode, 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, toStream, touch, touchAsync, unlink, unlinkAsync
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
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
clearExpire, expire, expireAt, expireAt, remainTimeToLive
copy, delete, dump, getCodec, getName, isExists, migrate, move, rename, renamenx, restore, restore, restoreAndReplace, restoreAndReplace, sizeInMemory, touch, unlink
sizeAsync
addAndGetAsync, fastPutAsync, fastPutIfAbsentAsync, fastRemoveAsync, fastReplaceAsync, getAllAsync, getAsync, loadAllAsync, loadAllAsync, putAllAsync, putAllAsync, putAsync, putIfAbsentAsync, removeAsync, removeAsync, replaceAsync, replaceAsync, valueSizeAsync
expireAtAsync, remainTimeToLiveAsync
copyAsync, dumpAsync, isExistsAsync, migrateAsync, moveAsync, renameAsync, renamenxAsync, restoreAndReplaceAsync, restoreAndReplaceAsync, restoreAsync, restoreAsync, touchAsync, unlinkAsync
public RedissonMapCache(EvictionScheduler evictionScheduler, CommandAsyncExecutor commandExecutor, String name, RedissonClient redisson, MapOptions<K,V> options)
public RedissonMapCache(Codec codec, EvictionScheduler evictionScheduler, CommandAsyncExecutor commandExecutor, String name, RedissonClient redisson, MapOptions<K,V> options)
public boolean trySetMaxSize(int maxSize)
RMapCache
trySetMaxSize
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 RFuture<Boolean> trySetMaxSizeAsync(int maxSize)
RMapCacheAsync
trySetMaxSizeAsync
in interface RMapCacheAsync<K,V>
maxSize
- - max sizetrue
if max size has been successfully set, otherwise false
.public void setMaxSize(int maxSize)
RMapCache
setMaxSize
in interface RMapCache<K,V>
maxSize
- - max size
If 0
the cache is unbounded (default).public RFuture<Void> setMaxSizeAsync(int maxSize)
RMapCacheAsync
setMaxSizeAsync
in interface RMapCacheAsync<K,V>
maxSize
- - max sizepublic 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<Map<K,V>> getAllOperationAsync(Set<K> keys)
getAllOperationAsync
in class RedissonMap<K,V>
public V putIfAbsent(K key, V value, long ttl, TimeUnit ttlUnit)
RMapCache
Stores 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)
RMapCacheAsync
Stores 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)
RMapCache
Stores 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)
RMapCacheAsync
Stores 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)
RMapCache
If 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> putIfAbsentOperationAsync(K key, V value)
putIfAbsentOperationAsync
in class RedissonMap<K,V>
public void putAll(Map<? extends K,? extends V> map, long ttl, TimeUnit ttlUnit)
RMapCache
value
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)
RMapCache
value
with the specified key
in batch.
If MapWriter
is defined then new map entries are stored in write-through mode.
putAllAsync
in interface RMapCache<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)
RMap
delta
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)
RMapCache
If 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)
RMapCacheAsync
If 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)
RMapCache
If 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)
RMapCacheAsync
If 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 RFuture<V> putAsync(K key, V value, long ttl, TimeUnit ttlUnit)
RMapCacheAsync
putAsync
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)
RMapCache
If 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)
RMapCacheAsync
If 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)
public long remainTimeToLive(K key)
RMapCache
key
.remainTimeToLive
in interface RMapCache<K,V>
key
- - map keypublic RFuture<Long> remainTimeToLiveAsync(K key)
RMapCacheAsync
key
.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> fastPutIfAbsentOperationAsync(K key, V value)
fastPutIfAbsentOperationAsync
in class RedissonMap<K,V>
public boolean fastPutIfAbsent(K key, V value, long ttl, TimeUnit ttlUnit)
RMapCache
Stores 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)
RMapCache
Stores 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)
RMapCacheAsync
Stores 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)
RMapCache
addListener
in interface RMapCache<K,V>
listener
- - entry listenerEntryCreatedListener
,
EntryUpdatedListener
,
EntryRemovedListener
,
EntryExpiredListener
public void removeListener(int listenerId)
RMapCache
removeListener
in interface RMapCache<K,V>
listenerId
- - listener idpublic 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<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 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 RFuture<Boolean> clearExpireAsync()
RExpirableAsync
clearExpireAsync
in interface RExpirableAsync
true
if the timeout was cleared and false
if notpublic RFuture<Set<K>> readAllKeySetAsync()
RMapAsync
readAllKeySetAsync
in interface RMapAsync<K,V>
readAllKeySetAsync
in class RedissonMap<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<Map<K,V>> readAllMapAsync()
RMapAsync
readAllMapAsync
in interface RMapAsync<K,V>
readAllMapAsync
in class RedissonMap<K,V>
public RFuture<Collection<V>> readAllValuesAsync()
RMapAsync
readAllValuesAsync
in interface RMapAsync<K,V>
readAllValuesAsync
in class RedissonMap<K,V>
public void destroy()
RDestroyable
destroy
in interface RDestroyable
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 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 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 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.