V - value typepublic class RedissonBucket<V> extends RedissonObject implements RBucket<V>
codec, commandExecutor, name| Constructor and Description |
|---|
RedissonBucket(Codec codec,
CommandAsyncExecutor connectionManager,
String name) |
RedissonBucket(CommandAsyncExecutor connectionManager,
String name) |
| Modifier and Type | Method and Description |
|---|---|
int |
addListener(ObjectListener listener)
Adds object event listener
|
RFuture<Integer> |
addListenerAsync(ObjectListener listener)
Adds object event listener
|
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.
|
protected RFuture<Boolean> |
clearExpireAsync(String... keys) |
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.
|
protected RFuture<Boolean> |
expireAsync(long timeToLive,
TimeUnit timeUnit,
String... keys) |
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.
|
protected RFuture<Boolean> |
expireAtAsync(long timestamp,
String... keys) |
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 |
removeListener(int listenerId)
Removes object event listener
|
RFuture<Void> |
removeListenerAsync(int listenerId)
Removes object event listener
|
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. |
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.
|
RFuture<Boolean> |
setIfExistsAsync(V value)
Sets value only if it's already exists.
|
RFuture<Boolean> |
setIfExistsAsync(V value,
long timeToLive,
TimeUnit timeUnit)
Sets value only if it's already exists.
|
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, copy, copyAsync, delete, deleteAsync, deleteAsync, dump, dumpAsync, encode, encode, encode, encode, encodeMapKey, encodeMapKeys, encodeMapValue, encodeMapValues, get, getCodec, getIdleTime, getIdleTimeAsync, getLockByMapKey, getLockByValue, getName, getName, isExists, isExistsAsync, migrate, migrateAsync, move, moveAsync, prefixName, removeListenersAsync, rename, renameAsync, renamenx, renamenxAsync, restore, restore, restoreAndReplace, restoreAndReplace, restoreAndReplaceAsync, restoreAndReplaceAsync, restoreAsync, restoreAsync, sizeInMemory, sizeInMemoryAsync, sizeInMemoryAsync, sizeInMemoryAsync, suffixName, toSeconds, toStream, touch, touchAsync, unlink, unlinkAsyncclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitclearExpire, expire, expireAt, expireAt, remainTimeToLivecopy, delete, dump, getCodec, getIdleTime, getName, isExists, migrate, move, rename, renamenx, restore, restore, restoreAndReplace, restoreAndReplace, sizeInMemory, touch, unlinkclearExpireAsync, expireAsync, expireAtAsync, expireAtAsync, remainTimeToLiveAsynccopyAsync, deleteAsync, dumpAsync, getIdleTimeAsync, isExistsAsync, migrateAsync, moveAsync, renameAsync, renamenxAsync, restoreAndReplaceAsync, restoreAndReplaceAsync, restoreAsync, restoreAsync, sizeInMemoryAsync, touchAsync, unlinkAsyncpublic RedissonBucket(CommandAsyncExecutor connectionManager, String name)
public RedissonBucket(Codec codec, CommandAsyncExecutor connectionManager, String name)
public boolean compareAndSet(V expect, V update)
RBucketcompareAndSet 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)
RBucketAsynccompareAndSetAsync 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)
RBucketnewValue.public RFuture<V> getAndSetAsync(V newValue)
RBucketAsyncnewValue.getAndSetAsync in interface RBucketAsync<V>newValue - - value to setpublic V get()
RBucketpublic RFuture<V> getAsync()
RBucketAsyncgetAsync in interface RBucketAsync<V>public V getAndDelete()
RBucketgetAndDelete in interface RBucket<V>public RFuture<V> getAndDeleteAsync()
RBucketAsyncgetAndDeleteAsync in interface RBucketAsync<V>public long size()
RBucketpublic RFuture<Long> sizeAsync()
RBucketAsyncsizeAsync in interface RBucketAsync<V>public void set(V value)
RBucketpublic RFuture<Void> setAsync(V value)
RBucketAsyncsetAsync in interface RBucketAsync<V>value - - value to setpublic void set(V value, long timeToLive, TimeUnit timeUnit)
RBuckettimeToLive interval.public RFuture<Void> setAsync(V value, long timeToLive, TimeUnit timeUnit)
RBucketAsynctimeToLive 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)
RBucketAsynctrySetAsync 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)
RBucketAsynctimeToLive 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)
RBuckettimeToLive interval.public boolean trySet(V value)
RBucketpublic boolean setIfExists(V value)
RBucketsetIfExists in interface RBucket<V>value - - value to settrue if successful, or false if
element wasn't setpublic RFuture<Boolean> setIfExistsAsync(V value)
RBucketAsyncsetIfExistsAsync in interface RBucketAsync<V>value - - value to settrue if successful, or false if
element wasn't setpublic boolean setIfExists(V value, long timeToLive, TimeUnit timeUnit)
RBucketsetIfExists in interface RBucket<V>value - - value to settimeToLive - - time to live intervaltimeUnit - - unit of time to live intervaltrue if successful, or false if
element wasn't setpublic RFuture<Boolean> setIfExistsAsync(V value, long timeToLive, TimeUnit timeUnit)
RBucketAsyncsetIfExistsAsync in interface RBucketAsync<V>value - - value to settimeToLive - - time to live intervaltimeUnit - - unit of time to live intervaltrue if successful, or false if
element wasn't setpublic RFuture<V> getAndSetAsync(V value, long timeToLive, TimeUnit timeUnit)
RBucketAsyncnewValue 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)
RBucketnewValue with defined timeToLive interval.public int addListener(ObjectListener listener)
RObjectaddListener in interface RBucket<V>addListener in interface RObjectaddListener in class RedissonObjectlistener - - object event listenerExpiredObjectListener,
DeletedObjectListenerpublic RFuture<Integer> addListenerAsync(ObjectListener listener)
RObjectAsyncaddListenerAsync in interface RBucketAsync<V>addListenerAsync in interface RObjectAsyncaddListenerAsync in class RedissonObjectlistener - - object event listenerExpiredObjectListener,
DeletedObjectListenerpublic void removeListener(int listenerId)
RObjectremoveListener in interface RObjectremoveListener in class RedissonObjectlistenerId - - listener idpublic RFuture<Void> removeListenerAsync(int listenerId)
RObjectAsyncremoveListenerAsync in interface RObjectAsyncremoveListenerAsync in class RedissonObjectlistenerId - - listener idpublic boolean expire(long timeToLive,
TimeUnit timeUnit)
RExpirableexpire in interface RExpirabletimeToLive - - 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)
RExpirableAsyncexpireAsync in interface RExpirableAsynctimeToLive - - timeout before object will be deletedtimeUnit - - timeout time unittrue if the timeout was set and false if notpublic boolean expireAt(long timestamp)
RExpirableexpireAt in interface RExpirabletimestamp - - expire date in milliseconds (Unix timestamp)true if the timeout was set and false if notpublic RFuture<Boolean> expireAtAsync(long timestamp)
RExpirableAsyncexpireAtAsync in interface RExpirableAsynctimestamp - - expire date in milliseconds (Unix timestamp)true if the timeout was set and false if notpublic boolean expireAt(Date timestamp)
RExpirableexpireAt in interface RExpirabletimestamp - - expire datetrue if the timeout was set and false if notpublic RFuture<Boolean> expireAtAsync(Date timestamp)
RExpirableAsyncexpireAtAsync in interface RExpirableAsynctimestamp - - expire datetrue if the timeout was set and false if notpublic boolean clearExpire()
RExpirableclearExpire in interface RExpirabletrue if timeout was removed
false if object does not exist or does not have an associated timeoutpublic RFuture<Boolean> clearExpireAsync()
RExpirableAsyncclearExpireAsync in interface RExpirableAsynctrue if the timeout was cleared and false if notpublic long remainTimeToLive()
RExpirableremainTimeToLive in interface RExpirablepublic RFuture<Long> remainTimeToLiveAsync()
RExpirableAsyncremainTimeToLiveAsync in interface RExpirableAsyncprotected RFuture<Boolean> expireAsync(long timeToLive, TimeUnit timeUnit, String... keys)
Copyright © 2014–2020 Redisson. All rights reserved.