Package org.redisson.api
Interface RBucketReactive<V>
- Type Parameters:
V- - the type of object
- All Superinterfaces:
RExpirableReactive,RObjectReactive
- All Known Subinterfaces:
RBinaryStreamReactive,RJsonBucketReactive<V>
Reactive implementation of object holder. Max size of object is 512MB
- Author:
- Nikita Koksharov
-
Method Summary
Modifier and TypeMethodDescriptionreactor.core.publisher.Mono<Integer> addListener(ObjectListener listener) Adds object event listenerreactor.core.publisher.Mono<Boolean> compareAndSet(V expect, V update) Atomically sets the value to the given updated value only if serialized state of the current value equals to serialized state of the expected value.reactor.core.publisher.Mono<V> findCommon(String name) Returns the common part of the data stored in this bucket and a bucket defined by thenamereactor.core.publisher.Mono<Long> findCommonLength(String name) Returns the length of the common part of the data stored in this bucket and a bucket defined by thenamereactor.core.publisher.Mono<V> get()Retrieves element stored in the holder.reactor.core.publisher.Mono<V> Retrieves current element in the holder and clears expiration date set before.reactor.core.publisher.Mono<V> Retrieves element in the holder and removes it.reactor.core.publisher.Mono<V> getAndExpire(Duration duration) Retrieves current element in the holder and sets an expiration duration for it.reactor.core.publisher.Mono<V> getAndExpire(Instant time) Retrieves current element in the holder and sets an expiration date for it.reactor.core.publisher.Mono<V> Retrieves current element in the holder and replaces it withnewValue.reactor.core.publisher.Mono<V> Deprecated.reactor.core.publisher.Mono<V> Retrieves current element in the holder and replaces it withvaluewith defined expirationduration.reactor.core.publisher.Mono<Void> Stores element into the holder.reactor.core.publisher.Mono<Void> Deprecated.reactor.core.publisher.Mono<Void> Storesvalueinto the holder with defined expirationduration.reactor.core.publisher.Mono<Void> setAndKeepTTL(V value) Set value and keep existing TTL.reactor.core.publisher.Mono<Boolean> setIfAbsent(V value) Sets value only if object holder doesn't exist.reactor.core.publisher.Mono<Boolean> setIfAbsent(V value, Duration duration) Sets value with defined duration only if object holder doesn't exist.reactor.core.publisher.Mono<Boolean> setIfExists(V value) Sets value only if it's already exists.reactor.core.publisher.Mono<Boolean> setIfExists(V value, long timeToLive, TimeUnit timeUnit) Deprecated.reactor.core.publisher.Mono<Boolean> setIfExists(V value, Duration duration) Setsvaluewith expirationdurationonly if object holder already exists.reactor.core.publisher.Mono<Long> size()Returns size of object in bytesreactor.core.publisher.Mono<Boolean> Deprecated.reactor.core.publisher.Mono<Boolean> Deprecated.Methods inherited from interface org.redisson.api.RExpirableReactive
clearExpire, expire, expire, expire, expireAt, expireAt, expireIfGreater, expireIfGreater, expireIfLess, expireIfLess, expireIfNotSet, expireIfNotSet, expireIfSet, expireIfSet, getExpireTime, remainTimeToLiveMethods inherited from interface org.redisson.api.RObjectReactive
copy, copy, copy, copyAndReplace, copyAndReplace, delete, dump, getCodec, getIdleTime, getName, isExists, migrate, move, removeListener, rename, renamenx, restore, restore, restoreAndReplace, restoreAndReplace, sizeInMemory, touch, unlink
-
Method Details
-
size
reactor.core.publisher.Mono<Long> size()Returns size of object in bytes- Returns:
- object size
-
setIfAbsent
Sets value only if object holder doesn't exist.- Parameters:
value- - value to set- Returns:
trueif successful, orfalseif element was already set
-
setIfAbsent
Sets value with defined duration only if object holder doesn't exist.- Parameters:
value- value to setduration- expiration duration- Returns:
trueif successful, orfalseif element was already set
-
trySet
Deprecated.UsesetIfAbsent(Object)instead- Parameters:
value- - value to set- Returns:
trueif successful, orfalseif element was already set
-
trySet
@Deprecated reactor.core.publisher.Mono<Boolean> trySet(V value, long timeToLive, TimeUnit timeUnit) Deprecated.UsesetIfAbsent(Object, Duration)instead- Parameters:
value- - value to settimeToLive- - time to live intervaltimeUnit- - unit of time to live interval- Returns:
trueif successful, orfalseif element was already set
-
setIfExists
Sets value only if it's already exists.- Parameters:
value- - value to set- Returns:
trueif successful, orfalseif element wasn't set
-
setIfExists
@Deprecated reactor.core.publisher.Mono<Boolean> setIfExists(V value, long timeToLive, TimeUnit timeUnit) Deprecated.UsesetIfExists(Object, Duration)instead- Parameters:
value- - value to settimeToLive- - time to live intervaltimeUnit- - unit of time to live interval- Returns:
trueif successful, orfalseif element wasn't set
-
setIfExists
Setsvaluewith expirationdurationonly if object holder already exists.- Parameters:
value- value to setduration- expiration duration- Returns:
trueif successful, orfalseif element wasn't set
-
compareAndSet
Atomically sets the value to the given updated value only if serialized state of the current value equals to serialized state of the expected value.- Parameters:
expect- the expected valueupdate- the new value- Returns:
trueif successful; orfalseif the actual value was not equal to the expected value.
-
getAndSet
Retrieves current element in the holder and replaces it withnewValue.- Parameters:
newValue- - value to set- Returns:
- previous value
-
getAndSet
Deprecated.UsegetAndSet(Object, Duration)instead- Parameters:
value- - value to settimeToLive- - time to live intervaltimeUnit- - unit of time to live interval- Returns:
- previous value
-
getAndSet
Retrieves current element in the holder and replaces it withvaluewith defined expirationduration.- Parameters:
value- value to setduration- expiration duration- Returns:
- previous value
-
getAndExpire
Retrieves current element in the holder and sets an expiration duration for it.Requires Redis 6.2.0 and higher.
- Parameters:
duration- of object time to live interval- Returns:
- element
-
getAndExpire
Retrieves current element in the holder and sets an expiration date for it.Requires Redis 6.2.0 and higher.
- Parameters:
time- of exact object expiration moment- Returns:
- element
-
getAndClearExpire
reactor.core.publisher.Mono<V> getAndClearExpire()Retrieves current element in the holder and clears expiration date set before.Requires Redis 6.2.0 and higher.
- Returns:
- element
-
get
reactor.core.publisher.Mono<V> get()Retrieves element stored in the holder.- Returns:
- element
-
getAndDelete
reactor.core.publisher.Mono<V> getAndDelete()Retrieves element in the holder and removes it.- Returns:
- element
-
set
Stores element into the holder.- Parameters:
value- - value to set- Returns:
- void
-
set
Deprecated.Useset(Object, Duration)instead- Parameters:
value- - value to settimeToLive- - time to live intervaltimeUnit- - unit of time to live interval- Returns:
- void
-
set
Storesvalueinto the holder with defined expirationduration.- Parameters:
value- value to setduration- expiration duration
-
setAndKeepTTL
Set value and keep existing TTL.Requires Redis 6.0.0 and higher.
- Parameters:
value- - value to set- Returns:
- void
-
addListener
Adds object event listener- Specified by:
addListenerin interfaceRObjectReactive- Parameters:
listener- - object event listener- Returns:
- listener id
- See Also:
-
findCommon
Returns the common part of the data stored in this bucket and a bucket defined by thename- Parameters:
name- second bucket- Returns:
- common part of the data
-
findCommonLength
Returns the length of the common part of the data stored in this bucket and a bucket defined by thename- Parameters:
name- second bucket- Returns:
- common part of the data
-