K
- keyV
- valuepublic interface RMapCacheAsync<K,V> extends RMapAsync<K,V>
Map-based cache with ability to set TTL for each entry via
RMapCache.put(Object, Object, long, TimeUnit)
or RMapCache.putIfAbsent(Object, Object, long, TimeUnit)
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.
Expired tasks cleaned by 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
.
Modifier and Type | Method and Description |
---|---|
RFuture<Boolean> |
fastPutAsync(K key,
V value,
long ttl,
TimeUnit unit)
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.
|
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.
|
RFuture<V> |
putAsync(K key,
V value,
long ttl,
TimeUnit unit)
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.
|
RFuture<V> |
putIfAbsentAsync(K key,
V value,
long ttl,
TimeUnit unit)
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.
|
RFuture<Long> |
remainTimeToLiveAsync(K key)
Remaining time to live of map entry associated with a
key . |
RFuture<Void> |
setMaxSizeAsync(int maxSize)
Sets max size of the map.
|
RFuture<Integer> |
sizeAsync()
Returns the number of entries in cache.
|
RFuture<Boolean> |
trySetMaxSizeAsync(int maxSize)
Tries to set max size of the map.
|
addAndGetAsync, containsKeyAsync, containsValueAsync, fastPutAsync, fastPutIfAbsentAsync, fastRemoveAsync, fastReplaceAsync, getAllAsync, getAsync, loadAllAsync, loadAllAsync, putAllAsync, putAsync, putIfAbsentAsync, readAllEntrySetAsync, readAllKeySetAsync, readAllMapAsync, readAllValuesAsync, removeAsync, removeAsync, replaceAsync, replaceAsync, valueSizeAsync
clearExpireAsync, expireAsync, expireAtAsync, expireAtAsync, remainTimeToLiveAsync
copyAsync, deleteAsync, isExistsAsync, migrateAsync, moveAsync, renameAsync, renamenxAsync, touchAsync, unlinkAsync
RFuture<Void> setMaxSizeAsync(int maxSize)
maxSize
- - max sizeRFuture<Boolean> trySetMaxSizeAsync(int maxSize)
maxSize
- - max sizetrue
if max size has been successfully set, otherwise false
.RFuture<V> putIfAbsentAsync(K key, V value, long ttl, TimeUnit unit)
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.
key
- - map keyvalue
- - map valuettl
- - time to live for key\value entry.
If 0
then stores infinitely.unit
- - time unitRFuture<V> putIfAbsentAsync(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. 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.
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.
RFuture<V> putAsync(K key, V value, long ttl, TimeUnit unit)
key
- - map keyvalue
- - map valuettl
- - time to live for key\value entry.
If 0
then stores infinitely.unit
- - time unitRFuture<V> putAsync(K key, V value, long ttl, TimeUnit ttlUnit, long maxIdleTime, TimeUnit maxIdleUnit)
If the map previously contained a mapping for the key, the old value is replaced by the specified value.
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.
RFuture<Boolean> fastPutAsync(K key, V value, long ttl, TimeUnit unit)
If the map previously contained a mapping for the key, the old value is replaced by the specified value.
Works faster than usual putAsync(Object, Object, long, TimeUnit)
as it not returns previous value.
key
- - map keyvalue
- - map valuettl
- - time to live for key\value entry.
If 0
then stores infinitely.unit
- - 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.RFuture<Boolean> fastPutAsync(K key, V value, long ttl, TimeUnit ttlUnit, long maxIdleTime, TimeUnit maxIdleUnit)
If the map previously contained a mapping for the key, the old value is replaced by the specified value.
Works faster than usual putAsync(Object, Object, long, TimeUnit, long, TimeUnit)
as it not returns previous value.
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.RFuture<Boolean> fastPutIfAbsentAsync(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. Entry expires when specified time to live or max idle time has expired.
Works faster than usual putIfAbsentAsync(Object, Object, long, TimeUnit, long, TimeUnit)
as it not returns previous value.
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 hashRFuture<Integer> sizeAsync()
Copyright © 2014–2018 The Redisson Project. All rights reserved.