K
- keyV
- valuepublic interface RMapCacheReactive<K,V> extends RMapReactive<K,V>, RDestroyable
Map-based cache with ability to set TTL for each entry via
put(Object, Object, long, TimeUnit)
or putIfAbsent(Object, Object, long, TimeUnit)
method.
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 RedissonMapReactive
.
Modifier and Type | Method and Description |
---|---|
reactor.core.publisher.Mono<Boolean> |
fastPut(K key,
V value,
long ttl,
TimeUnit unit)
Stores value mapped by key with specified time to live.
|
reactor.core.publisher.Mono<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.
|
reactor.core.publisher.Mono<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.
|
reactor.core.publisher.Mono<V> |
put(K key,
V value,
long ttl,
TimeUnit unit)
Stores value mapped by key with specified time to live.
|
reactor.core.publisher.Mono<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.
|
reactor.core.publisher.Mono<V> |
putIfAbsent(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.
|
reactor.core.publisher.Mono<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.
|
reactor.core.publisher.Mono<Long> |
remainTimeToLive(K key)
Remaining time to live of map entry associated with a
key . |
reactor.core.publisher.Mono<Void> |
setMaxSize(int maxSize)
Sets max size of the map.
|
reactor.core.publisher.Mono<Integer> |
size()
Returns the number of entries in cache.
|
reactor.core.publisher.Mono<Boolean> |
trySetMaxSize(int maxSize)
Tries to set max size of the map.
|
addAndGet, containsKey, containsValue, entryIterator, entryIterator, entryIterator, entryIterator, fastPut, fastPutIfAbsent, fastRemove, get, getAll, getFairLock, getLock, getPermitExpirableSemaphore, getReadWriteLock, getSemaphore, keyIterator, keyIterator, keyIterator, keyIterator, loadAll, loadAll, put, putAll, putIfAbsent, readAllEntrySet, readAllKeySet, readAllMap, readAllValues, remove, remove, replace, replace, valueIterator, valueIterator, valueIterator, valueIterator, valueSize
clearExpire, expire, expireAt, expireAt, remainTimeToLive
addListener, copy, delete, dump, getCodec, getName, isExists, migrate, move, removeListener, rename, renamenx, restore, restore, restoreAndReplace, restoreAndReplace, sizeInMemory, touch, unlink
destroy
reactor.core.publisher.Mono<Void> setMaxSize(int maxSize)
maxSize
- - max sizereactor.core.publisher.Mono<Boolean> trySetMaxSize(int maxSize)
maxSize
- - max sizetrue
if max size has been successfully set, otherwise false
.reactor.core.publisher.Mono<V> putIfAbsent(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 unitreactor.core.publisher.Mono<V> putIfAbsent(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.
reactor.core.publisher.Mono<V> put(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 unitreactor.core.publisher.Mono<V> put(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.
reactor.core.publisher.Mono<Boolean> fastPut(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 put(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.reactor.core.publisher.Mono<Boolean> fastPut(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 put(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.reactor.core.publisher.Mono<Boolean> fastPutIfAbsent(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 putIfAbsent(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 hashreactor.core.publisher.Mono<Integer> size()
size
in interface RMapReactive<K,V>
Copyright © 2014–2020 Redisson. All rights reserved.