K
- keyV
- valuepublic class RedissonMapCacheReactive<K,V> extends Object implements RMapCacheReactive<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)
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
.
Constructor and Description |
---|
RedissonMapCacheReactive(UUID id,
EvictionScheduler evictionScheduler,
Codec codec,
CommandReactiveExecutor commandExecutor,
String name) |
RedissonMapCacheReactive(UUID id,
EvictionScheduler evictionScheduler,
CommandReactiveExecutor commandExecutor,
String name) |
Modifier and Type | Method and Description |
---|---|
org.reactivestreams.Publisher<V> |
addAndGet(K key,
Number delta) |
org.reactivestreams.Publisher<Boolean> |
clearExpire()
Clear an expire timeout or expire date for object in mode.
|
org.reactivestreams.Publisher<Boolean> |
containsKey(Object key) |
org.reactivestreams.Publisher<Boolean> |
containsValue(Object value) |
org.reactivestreams.Publisher<Boolean> |
delete()
Delete object in mode
|
org.reactivestreams.Publisher<Map.Entry<K,V>> |
entryIterator() |
boolean |
equals(Object o) |
org.reactivestreams.Publisher<Boolean> |
expire(long timeToLive,
TimeUnit timeUnit)
Set a timeout for object in mode.
|
org.reactivestreams.Publisher<Boolean> |
expireAt(Date timestamp)
Set an expire date for object in mode.
|
org.reactivestreams.Publisher<Boolean> |
expireAt(long timestamp)
Set an expire date for object in mode.
|
org.reactivestreams.Publisher<Boolean> |
fastPut(K key,
V value)
Associates the specified
value with the specified key
in manner. |
org.reactivestreams.Publisher<Long> |
fastRemove(K... keys)
Removes
keys from map by one operation in manner
Works faster than RMap.remove but not returning
the value associated with key |
org.reactivestreams.Publisher<V> |
get(K key) |
org.reactivestreams.Publisher<Map<K,V>> |
getAll(Set<K> keys) |
Codec |
getCodec() |
String |
getName() |
int |
hashCode() |
org.reactivestreams.Publisher<Boolean> |
isExists()
Check object existence
|
org.reactivestreams.Publisher<K> |
keyIterator() |
org.reactivestreams.Publisher<Void> |
migrate(String host,
int port,
int database)
Transfer a object from a source Redis instance to a destination Redis instance
in mode
|
org.reactivestreams.Publisher<Boolean> |
move(int database)
Move object to another database in mode
|
protected <V> reactor.rx.Stream<V> |
newSucceeded(V result) |
org.reactivestreams.Publisher<V> |
put(K key,
V value) |
org.reactivestreams.Publisher<V> |
put(K key,
V value,
long ttl,
TimeUnit unit) |
org.reactivestreams.Publisher<Void> |
putAll(Map<? extends K,? extends V> map) |
org.reactivestreams.Publisher<V> |
putIfAbsent(K key,
V value) |
org.reactivestreams.Publisher<V> |
putIfAbsent(K key,
V value,
long ttl,
TimeUnit unit) |
<R> org.reactivestreams.Publisher<R> |
reactive(RFuture<R> future) |
org.reactivestreams.Publisher<Long> |
remainTimeToLive()
Get remaining time to live of object in milliseconds.
|
org.reactivestreams.Publisher<V> |
remove(K key) |
org.reactivestreams.Publisher<Boolean> |
remove(Object key,
Object value) |
org.reactivestreams.Publisher<Void> |
rename(String newName)
Rename current object key to
newName
in mode |
org.reactivestreams.Publisher<Boolean> |
renamenx(String newName)
Rename current object key to
newName
in mode only if new key is not exists |
org.reactivestreams.Publisher<V> |
replace(K key,
V value) |
org.reactivestreams.Publisher<Boolean> |
replace(K key,
V oldValue,
V newValue) |
org.reactivestreams.Publisher<MapScanResult<ScanObjectEntry,ScanObjectEntry>> |
scanIteratorReactive(InetSocketAddress client,
long startPos) |
org.reactivestreams.Publisher<Integer> |
size()
Returns the number of entries in cache.
|
org.reactivestreams.Publisher<V> |
valueIterator() |
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
expireAt, remainTimeToLive
public RedissonMapCacheReactive(UUID id, EvictionScheduler evictionScheduler, CommandReactiveExecutor commandExecutor, String name)
public RedissonMapCacheReactive(UUID id, EvictionScheduler evictionScheduler, Codec codec, CommandReactiveExecutor commandExecutor, String name)
public org.reactivestreams.Publisher<Boolean> containsKey(Object key)
containsKey
in interface RMapReactive<K,V>
public org.reactivestreams.Publisher<Boolean> containsValue(Object value)
containsValue
in interface RMapReactive<K,V>
public org.reactivestreams.Publisher<Map<K,V>> getAll(Set<K> keys)
getAll
in interface RMapReactive<K,V>
public org.reactivestreams.Publisher<V> putIfAbsent(K key, V value, long ttl, TimeUnit unit)
putIfAbsent
in interface RMapCacheReactive<K,V>
public org.reactivestreams.Publisher<Boolean> remove(Object key, Object value)
remove
in interface RMapReactive<K,V>
public org.reactivestreams.Publisher<V> get(K key)
get
in interface RMapReactive<K,V>
public org.reactivestreams.Publisher<V> put(K key, V value, long ttl, TimeUnit unit)
put
in interface RMapCacheReactive<K,V>
public org.reactivestreams.Publisher<V> remove(K key)
remove
in interface RMapReactive<K,V>
public org.reactivestreams.Publisher<Long> fastRemove(K... keys)
RMapReactive
keys
from map by one operation in manner
Works faster than RMap.remove
but not returning
the value associated with key
fastRemove
in interface RMapReactive<K,V>
keys
- - map keyspublic org.reactivestreams.Publisher<MapScanResult<ScanObjectEntry,ScanObjectEntry>> scanIteratorReactive(InetSocketAddress client, long startPos)
public org.reactivestreams.Publisher<Boolean> delete()
RObjectReactive
delete
in interface RObjectReactive
true
if object was deleted false
if notpublic org.reactivestreams.Publisher<Boolean> expire(long timeToLive, TimeUnit timeUnit)
RExpirableReactive
expire
in interface RExpirableReactive
timeToLive
- - timeout before object will be deletedtimeUnit
- - timeout time unittrue
if the timeout was set and false
if notpublic org.reactivestreams.Publisher<Boolean> expireAt(long timestamp)
RExpirableReactive
expireAt
in interface RExpirableReactive
timestamp
- - expire date in milliseconds (Unix timestamp)true
if the timeout was set and false
if notpublic org.reactivestreams.Publisher<Boolean> clearExpire()
RExpirableReactive
clearExpire
in interface RExpirableReactive
true
if the timeout was cleared and false
if notpublic org.reactivestreams.Publisher<Void> putAll(Map<? extends K,? extends V> map)
putAll
in interface RMapReactive<K,V>
public org.reactivestreams.Publisher<V> addAndGet(K key, Number delta)
addAndGet
in interface RMapReactive<K,V>
public org.reactivestreams.Publisher<Boolean> fastPut(K key, V value)
RMapReactive
value
with the specified key
in manner.
Works faster than RMap.put
but not returning
the previous value associated with key
fastPut
in interface RMapReactive<K,V>
key
- - map keyvalue
- - map valuetrue
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 org.reactivestreams.Publisher<V> put(K key, V value)
put
in interface RMapReactive<K,V>
public org.reactivestreams.Publisher<V> replace(K key, V value)
replace
in interface RMapReactive<K,V>
public org.reactivestreams.Publisher<Boolean> replace(K key, V oldValue, V newValue)
replace
in interface RMapReactive<K,V>
public org.reactivestreams.Publisher<V> putIfAbsent(K key, V value)
putIfAbsent
in interface RMapReactive<K,V>
public org.reactivestreams.Publisher<Map.Entry<K,V>> entryIterator()
entryIterator
in interface RMapReactive<K,V>
public org.reactivestreams.Publisher<V> valueIterator()
valueIterator
in interface RMapReactive<K,V>
public org.reactivestreams.Publisher<K> keyIterator()
keyIterator
in interface RMapReactive<K,V>
public org.reactivestreams.Publisher<Integer> size()
RMapCacheReactive
size
in interface RMapCacheReactive<K,V>
size
in interface RMapReactive<K,V>
public org.reactivestreams.Publisher<Boolean> expireAt(Date timestamp)
RExpirableReactive
expireAt
in interface RExpirableReactive
timestamp
- - expire datetrue
if the timeout was set and false
if notpublic org.reactivestreams.Publisher<Long> remainTimeToLive()
RExpirableReactive
remainTimeToLive
in interface RExpirableReactive
public <R> org.reactivestreams.Publisher<R> reactive(RFuture<R> future)
protected <V> reactor.rx.Stream<V> newSucceeded(V result)
public String getName()
getName
in interface RObjectReactive
public Codec getCodec()
getCodec
in interface RObjectReactive
public org.reactivestreams.Publisher<Void> rename(String newName)
RObjectReactive
newName
in moderename
in interface RObjectReactive
newName
- - new name of objectpublic org.reactivestreams.Publisher<Void> migrate(String host, int port, int database)
RObjectReactive
migrate
in interface RObjectReactive
host
- - destination hostport
- - destination portdatabase
- - destination databasepublic org.reactivestreams.Publisher<Boolean> move(int database)
RObjectReactive
move
in interface RObjectReactive
database
- - number of Redis databasetrue
if key was moved false
if notpublic org.reactivestreams.Publisher<Boolean> renamenx(String newName)
RObjectReactive
newName
in mode only if new key is not existsrenamenx
in interface RObjectReactive
newName
- - new name of objecttrue
if object has been renamed successfully and false
otherwisepublic org.reactivestreams.Publisher<Boolean> isExists()
RObjectReactive
isExists
in interface RObjectReactive
true
if object exists and false
otherwiseCopyright © 2014–2017 The Redisson Project. All rights reserved.