Package org.redisson.api
Interface RBucket<V>
- Type Parameters:
V- - the type of object
- All Superinterfaces:
RBucketAsync<V>,RExpirable,RExpirableAsync,RObject,RObjectAsync
- All Known Subinterfaces:
RBinaryStream,RJsonBucket<V>
- All Known Implementing Classes:
ExpireAtOperation.RedissonBucketExtended,ExpireOperation.RedissonBucketExtended,RedissonBinaryStream,RedissonBucket,RedissonJsonBucket,RedissonTransactionalBucket
Object holder. Max size of object is 512MB
- Author:
- Nikita Koksharov
-
Method Summary
Modifier and TypeMethodDescriptionintaddListener(ObjectListener listener) Adds object event listenerbooleancompareAndSet(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.get()Retrieves element stored in the holder.Retrieves current element in the holder and clears expiration date set before.Retrieves element in the holder and removes it.getAndExpire(Duration duration) Retrieves current element in the holder and sets an expiration duration for it.getAndExpire(Instant time) Retrieves current element in the holder and sets an expiration date for it.Retrieves current element in the holder and replaces it withnewValue.Retrieves current element in the holder and replaces it withnewValuewith definedtimeToLiveinterval.voidStores element into the holder.voidStores element into the holder with definedtimeToLiveinterval.voidsetAndKeepTTL(V value) Set value and keep existing TTL.booleansetIfAbsent(V value) Sets value only if object holder doesn't exist.booleansetIfAbsent(V value, Duration duration) Sets value with defined duration only if object holder doesn't exist.booleansetIfExists(V value) Sets value only if object holder already exists.booleansetIfExists(V value, long timeToLive, TimeUnit timeUnit) Sets value only if object holder already exists.longsize()Returns size of object in bytes.booleanDeprecated.booleanDeprecated.Methods inherited from interface org.redisson.api.RBucketAsync
addListenerAsync, compareAndSetAsync, getAndClearExpireAsync, getAndDeleteAsync, getAndExpireAsync, getAndExpireAsync, getAndSetAsync, getAndSetAsync, getAsync, setAndKeepTTLAsync, setAsync, setAsync, setIfAbsentAsync, setIfAbsentAsync, setIfExistsAsync, setIfExistsAsync, sizeAsync, trySetAsync, trySetAsyncMethods inherited from interface org.redisson.api.RExpirable
clearExpire, expire, expire, expire, expireAt, expireAt, expireIfGreater, expireIfGreater, expireIfLess, expireIfLess, expireIfNotSet, expireIfNotSet, expireIfSet, expireIfSet, getExpireTime, remainTimeToLiveMethods inherited from interface org.redisson.api.RExpirableAsync
clearExpireAsync, expireAsync, expireAsync, expireAsync, expireAtAsync, expireAtAsync, expireIfGreaterAsync, expireIfGreaterAsync, expireIfLessAsync, expireIfLessAsync, expireIfNotSetAsync, expireIfNotSetAsync, expireIfSetAsync, expireIfSetAsync, getExpireTimeAsync, remainTimeToLiveAsyncMethods inherited from interface org.redisson.api.RObject
copy, delete, dump, getCodec, getIdleTime, getName, isExists, migrate, move, removeListener, rename, renamenx, restore, restore, restoreAndReplace, restoreAndReplace, sizeInMemory, touch, unlinkMethods inherited from interface org.redisson.api.RObjectAsync
copyAsync, deleteAsync, dumpAsync, getIdleTimeAsync, isExistsAsync, migrateAsync, moveAsync, removeListenerAsync, renameAsync, renamenxAsync, restoreAndReplaceAsync, restoreAndReplaceAsync, restoreAsync, restoreAsync, sizeInMemoryAsync, touchAsync, unlinkAsync
-
Method Details
-
size
long size()Returns size of object in bytes.- Returns:
- object size
-
get
V get()Retrieves element stored in the holder.- Returns:
- element
-
getAndDelete
V getAndDelete()Retrieves element in the holder and removes it.- Returns:
- element
-
trySet
Deprecated.UsesetIfAbsent(Object)instead- Parameters:
value- - value to set- Returns:
trueif successful, orfalseif element was already set
-
trySet
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
-
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
-
setIfExists
Sets value only if object holder already exists.- Parameters:
value- - value to set- Returns:
trueif successful, orfalseif element wasn't set
-
setIfExists
Sets value only if object holder already exists.- Parameters:
value- - value to settimeToLive- - time to live intervaltimeUnit- - unit of time to live interval- 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
Retrieves current element in the holder and replaces it withnewValuewith definedtimeToLiveinterval.- Parameters:
value- - value to settimeToLive- - time to live intervaltimeUnit- - unit of time to live interval- 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
V getAndClearExpire()Retrieves current element in the holder and clears expiration date set before.Requires Redis 6.2.0 and higher.
- Returns:
- element
-
set
Stores element into the holder.- Parameters:
value- - value to set
-
set
Stores element into the holder with definedtimeToLiveinterval.- Parameters:
value- - value to settimeToLive- - time to live intervaltimeUnit- - unit of time to live interval
-
setAndKeepTTL
Set value and keep existing TTL.Requires Redis 6.0.0 and higher.
- Parameters:
value- - value to set
-
addListener
Adds object event listener- Specified by:
addListenerin interfaceRObject- Parameters:
listener- - object event listener- Returns:
- listener id
- See Also:
-