V
- value typepublic class RedissonBucket<V> extends RedissonObject implements RBucket<V>
codec, commandExecutor
Constructor and Description |
---|
RedissonBucket(Codec codec,
CommandAsyncExecutor connectionManager,
String name) |
RedissonBucket(CommandAsyncExecutor connectionManager,
String name) |
Modifier and Type | Method and Description |
---|---|
boolean |
clearExpire()
Clear an expire timeout or expire date for object.
|
RFuture<Boolean> |
clearExpireAsync()
Clear an expire timeout or expire date for object in async mode.
|
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.
|
RFuture<Boolean> |
compareAndSetAsync(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.
|
boolean |
expire(long timeToLive,
TimeUnit timeUnit)
Set a timeout for object.
|
RFuture<Boolean> |
expireAsync(long timeToLive,
TimeUnit timeUnit)
Set a timeout for object in async mode.
|
boolean |
expireAt(Date timestamp)
Set an expire date for object.
|
boolean |
expireAt(long timestamp)
Set an expire date for object.
|
RFuture<Boolean> |
expireAtAsync(Date timestamp)
Set an expire date for object in async mode.
|
RFuture<Boolean> |
expireAtAsync(long timestamp)
Set an expire date for object in async mode.
|
V |
get()
Retrieves element stored in the holder.
|
V |
getAndDelete()
Retrieves element in the holder and removes it.
|
RFuture<V> |
getAndDeleteAsync()
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. |
RFuture<V> |
getAndSetAsync(V newValue)
Retrieves current element in the holder and replaces it with
newValue . |
RFuture<V> |
getAndSetAsync(V value,
long timeToLive,
TimeUnit timeUnit)
Retrieves current element in the holder and replaces it with
newValue with defined timeToLive interval. |
RFuture<V> |
getAsync()
Retrieves element stored in the holder.
|
long |
remainTimeToLive()
Remaining time to live of Redisson object that has a timeout
|
RFuture<Long> |
remainTimeToLiveAsync()
Remaining time to live of Redisson object that has a timeout
|
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. |
RFuture<Void> |
setAsync(V value)
Stores element into the holder.
|
RFuture<Void> |
setAsync(V value,
long timeToLive,
TimeUnit timeUnit)
Stores element into the holder with defined
timeToLive interval. |
long |
size()
Returns size of object in bytes.
|
RFuture<Long> |
sizeAsync()
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. |
RFuture<Boolean> |
trySetAsync(V value)
Tries to set element atomically into empty holder.
|
RFuture<Boolean> |
trySetAsync(V value,
long timeToLive,
TimeUnit timeUnit)
Tries to set element atomically into empty holder with defined
timeToLive interval. |
addListener, addListenerAsync, await, copy, copyAsync, delete, deleteAsync, dump, dumpAsync, encode, encode, encode, encodeMapKey, encodeMapKeys, encodeMapValue, encodeMapValues, get, getCodec, getLockByMapKey, getLockByValue, getName, getName, isExists, isExistsAsync, migrate, migrateAsync, move, moveAsync, prefixName, removeListener, removeListenerAsync, rename, renameAsync, renamenx, renamenxAsync, restore, restore, restoreAndReplace, restoreAndReplace, restoreAndReplaceAsync, restoreAndReplaceAsync, restoreAsync, restoreAsync, sizeInMemory, sizeInMemoryAsync, sizeInMemoryAsync, suffixName, toSeconds, toStream, touch, touchAsync, unlink, unlinkAsync
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
clearExpire, expire, expireAt, expireAt, remainTimeToLive
addListener, copy, delete, dump, getCodec, getName, isExists, migrate, move, removeListener, rename, renamenx, restore, restore, restoreAndReplace, restoreAndReplace, sizeInMemory, touch, unlink
clearExpireAsync, expireAsync, expireAtAsync, expireAtAsync, remainTimeToLiveAsync
addListenerAsync, copyAsync, deleteAsync, dumpAsync, isExistsAsync, migrateAsync, moveAsync, removeListenerAsync, renameAsync, renamenxAsync, restoreAndReplaceAsync, restoreAndReplaceAsync, restoreAsync, restoreAsync, sizeInMemoryAsync, touchAsync, unlinkAsync
public RedissonBucket(CommandAsyncExecutor connectionManager, String name)
public RedissonBucket(Codec codec, CommandAsyncExecutor connectionManager, String name)
public boolean compareAndSet(V expect, V update)
RBucket
compareAndSet
in interface RBucket<V>
expect
- the expected valueupdate
- the new valuetrue
if successful; or false
if the actual value
was not equal to the expected value.public RFuture<Boolean> compareAndSetAsync(V expect, V update)
RBucketAsync
compareAndSetAsync
in interface RBucketAsync<V>
expect
- the expected valueupdate
- the new valuetrue
if successful; or false
if the actual value
was not equal to the expected value.public V getAndSet(V newValue)
RBucket
newValue
.public RFuture<V> getAndSetAsync(V newValue)
RBucketAsync
newValue
.getAndSetAsync
in interface RBucketAsync<V>
newValue
- - value to setpublic V get()
RBucket
public RFuture<V> getAsync()
RBucketAsync
getAsync
in interface RBucketAsync<V>
public V getAndDelete()
RBucket
getAndDelete
in interface RBucket<V>
public RFuture<V> getAndDeleteAsync()
RBucketAsync
getAndDeleteAsync
in interface RBucketAsync<V>
public long size()
RBucket
public RFuture<Long> sizeAsync()
RBucketAsync
sizeAsync
in interface RBucketAsync<V>
public void set(V value)
RBucket
public RFuture<Void> setAsync(V value)
RBucketAsync
setAsync
in interface RBucketAsync<V>
value
- - value to setpublic void set(V value, long timeToLive, TimeUnit timeUnit)
RBucket
timeToLive
interval.public RFuture<Void> setAsync(V value, long timeToLive, TimeUnit timeUnit)
RBucketAsync
timeToLive
interval.setAsync
in interface RBucketAsync<V>
value
- - value to settimeToLive
- - time to live intervaltimeUnit
- - unit of time to live intervalpublic RFuture<Boolean> trySetAsync(V value)
RBucketAsync
trySetAsync
in interface RBucketAsync<V>
value
- - value to settrue
if successful, or false
if
element was already setpublic RFuture<Boolean> trySetAsync(V value, long timeToLive, TimeUnit timeUnit)
RBucketAsync
timeToLive
interval.trySetAsync
in interface RBucketAsync<V>
value
- - value to settimeToLive
- - time to live intervaltimeUnit
- - unit of time to live intervaltrue
if successful, or false
if
element was already setpublic boolean trySet(V value, long timeToLive, TimeUnit timeUnit)
RBucket
timeToLive
interval.public boolean trySet(V value)
RBucket
public RFuture<V> getAndSetAsync(V value, long timeToLive, TimeUnit timeUnit)
RBucketAsync
newValue
with defined timeToLive
interval.getAndSetAsync
in interface RBucketAsync<V>
value
- - value to settimeToLive
- - time to live intervaltimeUnit
- - unit of time to live intervalpublic V getAndSet(V value, long timeToLive, TimeUnit timeUnit)
RBucket
newValue
with defined timeToLive
interval.public boolean expire(long timeToLive, TimeUnit timeUnit)
RExpirable
expire
in interface RExpirable
timeToLive
- - timeout before object will be deletedtimeUnit
- - timeout time unittrue
if the timeout was set and false
if notpublic RFuture<Boolean> expireAsync(long timeToLive, TimeUnit timeUnit)
RExpirableAsync
expireAsync
in interface RExpirableAsync
timeToLive
- - timeout before object will be deletedtimeUnit
- - timeout time unittrue
if the timeout was set and false
if notpublic boolean expireAt(long timestamp)
RExpirable
expireAt
in interface RExpirable
timestamp
- - expire date in milliseconds (Unix timestamp)true
if the timeout was set and false
if notpublic RFuture<Boolean> expireAtAsync(long timestamp)
RExpirableAsync
expireAtAsync
in interface RExpirableAsync
timestamp
- - expire date in milliseconds (Unix timestamp)true
if the timeout was set and false
if notpublic boolean expireAt(Date timestamp)
RExpirable
expireAt
in interface RExpirable
timestamp
- - expire datetrue
if the timeout was set and false
if notpublic RFuture<Boolean> expireAtAsync(Date timestamp)
RExpirableAsync
expireAtAsync
in interface RExpirableAsync
timestamp
- - expire datetrue
if the timeout was set and false
if notpublic boolean clearExpire()
RExpirable
clearExpire
in interface RExpirable
true
if timeout was removed
false
if object does not exist or does not have an associated timeoutpublic RFuture<Boolean> clearExpireAsync()
RExpirableAsync
clearExpireAsync
in interface RExpirableAsync
true
if the timeout was cleared and false
if notpublic long remainTimeToLive()
RExpirable
remainTimeToLive
in interface RExpirable
public RFuture<Long> remainTimeToLiveAsync()
RExpirableAsync
remainTimeToLiveAsync
in interface RExpirableAsync
Copyright © 2014–2019 The Redisson Project. All rights reserved.