V
- - the type of objectpublic interface RBucket<V> extends RExpirable, RBucketAsync<V>
Modifier and Type | Method and Description |
---|---|
int |
addListener(ObjectListener listener)
Adds object event listener
|
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.
|
V |
get()
Retrieves element stored in the holder.
|
V |
getAndDelete()
Retrieves element in the holder and removes it.
|
V |
getAndSet(V newValue)
Retrieves current element in the holder and replaces it with
newValue . |
V |
getAndSet(V value,
long timeToLive,
TimeUnit timeUnit)
Retrieves current element in the holder and replaces it with
newValue with defined timeToLive interval. |
void |
set(V value)
Stores element into the holder.
|
void |
set(V value,
long timeToLive,
TimeUnit timeUnit)
Stores element into the holder with defined
timeToLive interval. |
void |
setAndKeepTTL(V value)
Set value and keep existing TTL.
|
boolean |
setIfExists(V value)
Sets value only if it's already exists.
|
boolean |
setIfExists(V value,
long timeToLive,
TimeUnit timeUnit)
Sets value only if it's already exists.
|
long |
size()
Returns size of object in bytes.
|
boolean |
trySet(V value)
Tries to set element atomically into empty holder.
|
boolean |
trySet(V value,
long timeToLive,
TimeUnit timeUnit)
Tries to set element atomically into empty holder with defined
timeToLive interval. |
clearExpire, expire, expire, expireAt, expireAt, remainTimeToLive
copy, delete, dump, getCodec, getIdleTime, getName, isExists, migrate, move, removeListener, rename, renamenx, restore, restore, restoreAndReplace, restoreAndReplace, sizeInMemory, touch, unlink
addListenerAsync, compareAndSetAsync, getAndDeleteAsync, getAndSetAsync, getAndSetAsync, getAsync, setAndKeepTTLAsync, setAsync, setAsync, setIfExistsAsync, setIfExistsAsync, sizeAsync, trySetAsync, trySetAsync
clearExpireAsync, expireAsync, expireAsync, expireAtAsync, expireAtAsync, remainTimeToLiveAsync
copyAsync, deleteAsync, dumpAsync, getIdleTimeAsync, isExistsAsync, migrateAsync, moveAsync, removeListenerAsync, renameAsync, renamenxAsync, restoreAndReplaceAsync, restoreAndReplaceAsync, restoreAsync, restoreAsync, sizeInMemoryAsync, touchAsync, unlinkAsync
long size()
V get()
V getAndDelete()
boolean trySet(V value)
value
- - value to settrue
if successful, or false
if
element was already setboolean trySet(V value, long timeToLive, TimeUnit timeUnit)
timeToLive
interval.value
- - value to settimeToLive
- - time to live intervaltimeUnit
- - unit of time to live intervaltrue
if successful, or false
if
element was already setboolean setIfExists(V value)
value
- - value to settrue
if successful, or false
if
element wasn't setboolean setIfExists(V value, long timeToLive, TimeUnit timeUnit)
value
- - value to settimeToLive
- - time to live intervaltimeUnit
- - unit of time to live intervaltrue
if successful, or false
if
element wasn't setboolean compareAndSet(V expect, V update)
expect
- the expected valueupdate
- the new valuetrue
if successful; or false
if the actual value
was not equal to the expected value.V getAndSet(V newValue)
newValue
.newValue
- - value to setV getAndSet(V value, long timeToLive, TimeUnit timeUnit)
newValue
with defined timeToLive
interval.value
- - value to settimeToLive
- - time to live intervaltimeUnit
- - unit of time to live intervalvoid set(V value)
value
- - value to setvoid set(V value, long timeToLive, TimeUnit timeUnit)
timeToLive
interval.value
- - value to settimeToLive
- - time to live intervaltimeUnit
- - unit of time to live intervalvoid setAndKeepTTL(V value)
Requires Redis 6.0.0 and higher.
value
- - value to setint addListener(ObjectListener listener)
addListener
in interface RObject
listener
- - object event listenerExpiredObjectListener
,
DeletedObjectListener
,
SetObjectListener
Copyright © 2014–2021 Redisson. All rights reserved.