Class RedissonTransactionalBucket<V>

java.lang.Object
org.redisson.RedissonObject
org.redisson.RedissonBucket<V>
org.redisson.transaction.RedissonTransactionalBucket<V>
Type Parameters:
V - value type
All Implemented Interfaces:
RBucket<V>, RBucketAsync<V>, RExpirable, RExpirableAsync, RObject, RObjectAsync

public class RedissonTransactionalBucket<V> extends RedissonBucket<V>
Author:
Nikita Koksharov
  • Constructor Details Link icon

  • Method Details Link icon

    • expireAsync Link icon

      protected RFuture<Boolean> expireAsync(long timeToLive, TimeUnit timeUnit, String param, String... keys)
    • expireAtAsync Link icon

      protected RFuture<Boolean> expireAtAsync(long timestamp, String param, String... keys)
    • clearExpireAsync Link icon

      public RFuture<Boolean> clearExpireAsync()
      Description copied from interface: RExpirableAsync
      Clear an expire timeout or expire date for object in async mode. Object will not be deleted.
      Specified by:
      clearExpireAsync in interface RExpirableAsync
      Returns:
      true if the timeout was cleared and false if not
    • moveAsync Link icon

      public RFuture<Boolean> moveAsync(int database)
      Description copied from interface: RObjectAsync
      Move object to another database in async mode
      Specified by:
      moveAsync in interface RObjectAsync
      Overrides:
      moveAsync in class RedissonObject
      Parameters:
      database - - number of Redis database
      Returns:
      true if key was moved false if not
    • migrateAsync Link icon

      public RFuture<Void> migrateAsync(String host, int port, int database, long timeout)
      Description copied from interface: RObjectAsync
      Transfer object from source Redis instance to destination Redis instance in async mode
      Specified by:
      migrateAsync in interface RObjectAsync
      Overrides:
      migrateAsync in class RedissonObject
      Parameters:
      host - - destination host
      port - - destination port
      database - - destination database
      timeout - - maximum idle time in any moment of the communication with the destination instance in milliseconds
      Returns:
      void
    • sizeAsync Link icon

      public RFuture<Long> sizeAsync()
      Description copied from interface: RBucketAsync
      Returns size of object in bytes
      Specified by:
      sizeAsync in interface RBucketAsync<V>
      Overrides:
      sizeAsync in class RedissonBucket<V>
      Returns:
      object size
    • isExistsAsync Link icon

      public RFuture<Boolean> isExistsAsync()
      Description copied from interface: RObjectAsync
      Check object existence in async mode.
      Specified by:
      isExistsAsync in interface RObjectAsync
      Overrides:
      isExistsAsync in class RedissonObject
      Returns:
      true if object exists and false otherwise
    • touchAsync Link icon

      public RFuture<Boolean> touchAsync()
      Description copied from interface: RObjectAsync
      Update the last access time of an object in async mode.
      Specified by:
      touchAsync in interface RObjectAsync
      Overrides:
      touchAsync in class RedissonObject
      Returns:
      true if object was touched else false
    • unlinkAsync Link icon

      public RFuture<Boolean> unlinkAsync()
      Description copied from interface: RObjectAsync
      Delete the objects. Actual removal will happen later asynchronously.

      Requires Redis 4.0+

      Specified by:
      unlinkAsync in interface RObjectAsync
      Overrides:
      unlinkAsync in class RedissonObject
      Returns:
      true if it was exist and deleted else false
    • deleteAsync Link icon

      public RFuture<Boolean> deleteAsync()
      Description copied from interface: RObjectAsync
      Delete object in async mode
      Specified by:
      deleteAsync in interface RObjectAsync
      Overrides:
      deleteAsync in class RedissonObject
      Returns:
      true if object was deleted false if not
    • getAsync Link icon

      public RFuture<V> getAsync()
      Description copied from interface: RBucketAsync
      Retrieves element stored in the holder.
      Specified by:
      getAsync in interface RBucketAsync<V>
      Overrides:
      getAsync in class RedissonBucket<V>
      Returns:
      element
    • compareAndSetAsync Link icon

      public RFuture<Boolean> compareAndSetAsync(V expect, V update)
      Description copied from interface: RBucketAsync
      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.
      Specified by:
      compareAndSetAsync in interface RBucketAsync<V>
      Overrides:
      compareAndSetAsync in class RedissonBucket<V>
      Parameters:
      expect - the expected value
      update - the new value
      Returns:
      true if successful; or false if the actual value was not equal to the expected value.
    • getAndSetAsync Link icon

      public RFuture<V> getAndSetAsync(V value, long timeToLive, TimeUnit timeUnit)
      Description copied from interface: RBucketAsync
      Specified by:
      getAndSetAsync in interface RBucketAsync<V>
      Overrides:
      getAndSetAsync in class RedissonBucket<V>
      Parameters:
      value - - value to set
      timeToLive - - time to live interval
      timeUnit - - unit of time to live interval
      Returns:
      previous value
    • getAndSetAsync Link icon

      public RFuture<V> getAndSetAsync(V value)
      Description copied from interface: RBucketAsync
      Retrieves current element in the holder and replaces it with newValue.
      Specified by:
      getAndSetAsync in interface RBucketAsync<V>
      Overrides:
      getAndSetAsync in class RedissonBucket<V>
      Parameters:
      value - - value to set
      Returns:
      previous value
    • getAndDeleteAsync Link icon

      public RFuture<V> getAndDeleteAsync()
      Description copied from interface: RBucketAsync
      Retrieves element in the holder and removes it.
      Specified by:
      getAndDeleteAsync in interface RBucketAsync<V>
      Overrides:
      getAndDeleteAsync in class RedissonBucket<V>
      Returns:
      element
    • setAsync Link icon

      public RFuture<Void> setAsync(V newValue)
      Description copied from interface: RBucketAsync
      Stores element into the holder.
      Specified by:
      setAsync in interface RBucketAsync<V>
      Overrides:
      setAsync in class RedissonBucket<V>
      Parameters:
      newValue - - value to set
      Returns:
      void
    • setAsync Link icon

      public RFuture<Void> setAsync(V value, long timeToLive, TimeUnit timeUnit)
      Description copied from interface: RBucketAsync
      Specified by:
      setAsync in interface RBucketAsync<V>
      Overrides:
      setAsync in class RedissonBucket<V>
      Parameters:
      value - - value to set
      timeToLive - - time to live interval
      timeUnit - - unit of time to live interval
      Returns:
      void
    • trySetAsync Link icon

      public RFuture<Boolean> trySetAsync(V newValue)
      Description copied from interface: RBucketAsync
      Specified by:
      trySetAsync in interface RBucketAsync<V>
      Overrides:
      trySetAsync in class RedissonBucket<V>
      Parameters:
      newValue - - value to set
      Returns:
      true if successful, or false if element was already set
    • trySetAsync Link icon

      public RFuture<Boolean> trySetAsync(V value, long timeToLive, TimeUnit timeUnit)
      Description copied from interface: RBucketAsync
      Specified by:
      trySetAsync in interface RBucketAsync<V>
      Overrides:
      trySetAsync in class RedissonBucket<V>
      Parameters:
      value - - value to set
      timeToLive - - time to live interval
      timeUnit - - unit of time to live interval
      Returns:
      true if successful, or false if element was already set
    • executeLocked Link icon

      protected <R> RFuture<R> executeLocked(Supplier<CompletionStage<R>> runnable)
    • checkState Link icon

      protected void checkState()
    • expire Link icon

      public boolean expire(long timeToLive, TimeUnit timeUnit)
      Description copied from interface: RExpirable
      Specified by:
      expire in interface RExpirable
      Parameters:
      timeToLive - - timeout before object will be deleted
      timeUnit - - timeout time unit
      Returns:
      true if the timeout was set and false if not
    • expireAsync Link icon

      public RFuture<Boolean> expireAsync(long timeToLive, TimeUnit timeUnit)
      Description copied from interface: RExpirableAsync
      Specified by:
      expireAsync in interface RExpirableAsync
      Parameters:
      timeToLive - - timeout before object will be deleted
      timeUnit - - timeout time unit
      Returns:
      true if the timeout was set and false if not
    • expireAt Link icon

      public boolean expireAt(long timestamp)
      Description copied from interface: RExpirable
      Specified by:
      expireAt in interface RExpirable
      Parameters:
      timestamp - - expire date in milliseconds (Unix timestamp)
      Returns:
      true if the timeout was set and false if not
    • expireAtAsync Link icon

      public RFuture<Boolean> expireAtAsync(long timestamp)
      Description copied from interface: RExpirableAsync
      Specified by:
      expireAtAsync in interface RExpirableAsync
      Parameters:
      timestamp - - expire date in milliseconds (Unix timestamp)
      Returns:
      true if the timeout was set and false if not
    • expire Link icon

      public boolean expire(Instant instant)
      Description copied from interface: RExpirable
      Sets an expiration date for this object. When expire date comes the key will automatically be deleted.
      Specified by:
      expire in interface RExpirable
      Parameters:
      instant - expire date
      Returns:
      true if the timeout was set and false if not
    • expireIfSet Link icon

      public boolean expireIfSet(Instant time)
      Description copied from interface: RExpirable
      Sets an expiration date for this object only if it has been already set. When expire date comes the object will automatically be deleted.

      Requires Redis 7.0.0 and higher.

      Specified by:
      expireIfSet in interface RExpirable
      Parameters:
      time - expire date
      Returns:
      true if the timeout was set and false if not
    • expireIfSetAsync Link icon

      public RFuture<Boolean> expireIfSetAsync(Instant time)
      Description copied from interface: RExpirableAsync
      Sets an expiration date for this object only if it has been already set. When expire date comes the object will automatically be deleted.

      Requires Redis 7.0.0 and higher.

      Specified by:
      expireIfSetAsync in interface RExpirableAsync
      Parameters:
      time - expire date
      Returns:
      true if the timeout was set and false if not
    • expireIfNotSet Link icon

      public boolean expireIfNotSet(Instant time)
      Description copied from interface: RExpirable
      Sets an expiration date for this object only if it hasn't been set before. When expire date comes the object will automatically be deleted.

      Requires Redis 7.0.0 and higher.

      Specified by:
      expireIfNotSet in interface RExpirable
      Parameters:
      time - expire date
      Returns:
      true if the timeout was set and false if not
    • expireIfNotSetAsync Link icon

      public RFuture<Boolean> expireIfNotSetAsync(Instant time)
      Description copied from interface: RExpirableAsync
      Sets an expiration date for this object only if it hasn't been set before. When expire date comes the object will automatically be deleted.

      Requires Redis 7.0.0 and higher.

      Specified by:
      expireIfNotSetAsync in interface RExpirableAsync
      Parameters:
      time - expire date
      Returns:
      true if the timeout was set and false if not
    • expireIfGreater Link icon

      public boolean expireIfGreater(Instant time)
      Description copied from interface: RExpirable
      Sets an expiration date for this object only if it's greater than expiration date set before. When expire date comes the object will automatically be deleted.

      Requires Redis 7.0.0 and higher.

      Specified by:
      expireIfGreater in interface RExpirable
      Parameters:
      time - expire date
      Returns:
      true if the timeout was set and false if not
    • expireIfGreaterAsync Link icon

      public RFuture<Boolean> expireIfGreaterAsync(Instant time)
      Description copied from interface: RExpirableAsync
      Sets an expiration date for this object only if it's greater than expiration date set before. When expire date comes the object will automatically be deleted.

      Requires Redis 7.0.0 and higher.

      Specified by:
      expireIfGreaterAsync in interface RExpirableAsync
      Parameters:
      time - expire date
      Returns:
      true if the timeout was set and false if not
    • expireIfLess Link icon

      public boolean expireIfLess(Instant time)
      Description copied from interface: RExpirable
      Sets an expiration date for this object only if it's less than expiration date set before. When expire date comes the object will automatically be deleted.

      Requires Redis 7.0.0 and higher.

      Specified by:
      expireIfLess in interface RExpirable
      Parameters:
      time - expire date
      Returns:
      true if the timeout was set and false if not
    • expireIfLessAsync Link icon

      public RFuture<Boolean> expireIfLessAsync(Instant time)
      Description copied from interface: RExpirableAsync
      Sets an expiration date for this object only if it's less than expiration date set before. When expire date comes the object will automatically be deleted.

      Requires Redis 7.0.0 and higher.

      Specified by:
      expireIfLessAsync in interface RExpirableAsync
      Parameters:
      time - expire date
      Returns:
      true if the timeout was set and false if not
    • expireAsync Link icon

      public RFuture<Boolean> expireAsync(Instant instant)
      Description copied from interface: RExpirableAsync
      Set an expire date for object. When expire date comes the key will automatically be deleted.
      Specified by:
      expireAsync in interface RExpirableAsync
      Parameters:
      instant - - expire date
      Returns:
      true if the timeout was set and false if not
    • expire Link icon

      public boolean expire(Duration duration)
      Description copied from interface: RExpirable
      Sets a timeout for this object. After the timeout has expired, the key will automatically be deleted.
      Specified by:
      expire in interface RExpirable
      Parameters:
      duration - timeout before object will be deleted
      Returns:
      true if the timeout was set and false if not
    • expireAsync Link icon

      public RFuture<Boolean> expireAsync(Duration duration)
      Description copied from interface: RExpirableAsync
      Set a timeout for object. After the timeout has expired, the key will automatically be deleted.
      Specified by:
      expireAsync in interface RExpirableAsync
      Parameters:
      duration - timeout before object will be deleted
      Returns:
      true if the timeout was set and false if not
    • expireAt Link icon

      public boolean expireAt(Date timestamp)
      Description copied from interface: RExpirable
      Specified by:
      expireAt in interface RExpirable
      Parameters:
      timestamp - - expire date
      Returns:
      true if the timeout was set and false if not
    • expireAtAsync Link icon

      public RFuture<Boolean> expireAtAsync(Date timestamp)
      Description copied from interface: RExpirableAsync
      Specified by:
      expireAtAsync in interface RExpirableAsync
      Parameters:
      timestamp - - expire date
      Returns:
      true if the timeout was set and false if not
    • expireIfSet Link icon

      public boolean expireIfSet(Duration duration)
      Description copied from interface: RExpirable
      Sets a timeout for this object only if it has been already set. After the timeout has expired, the key will automatically be deleted.

      Requires Redis 7.0.0 and higher.

      Specified by:
      expireIfSet in interface RExpirable
      Parameters:
      duration - timeout before object will be deleted
      Returns:
      true if the timeout was set and false if not
    • expireIfSetAsync Link icon

      public RFuture<Boolean> expireIfSetAsync(Duration duration)
      Description copied from interface: RExpirableAsync
      Sets a timeout for this object only if it has been already set. After the timeout has expired, the key will automatically be deleted.

      Requires Redis 7.0.0 and higher.

      Specified by:
      expireIfSetAsync in interface RExpirableAsync
      Parameters:
      duration - timeout before object will be deleted
      Returns:
      true if the timeout was set and false if not
    • expireIfNotSet Link icon

      public boolean expireIfNotSet(Duration duration)
      Description copied from interface: RExpirable
      Sets a timeout for this object only if it hasn't been set before. After the timeout has expired, the key will automatically be deleted.

      Requires Redis 7.0.0 and higher.

      Specified by:
      expireIfNotSet in interface RExpirable
      Parameters:
      duration - timeout before object will be deleted
      Returns:
      true if the timeout was set and false if not
    • expireIfNotSetAsync Link icon

      public RFuture<Boolean> expireIfNotSetAsync(Duration duration)
      Description copied from interface: RExpirableAsync
      Sets a timeout for this object only if it hasn't been set before. After the timeout has expired, the key will automatically be deleted.

      Requires Redis 7.0.0 and higher.

      Specified by:
      expireIfNotSetAsync in interface RExpirableAsync
      Parameters:
      duration - timeout before object will be deleted
      Returns:
      true if the timeout was set and false if not
    • expireIfGreater Link icon

      public boolean expireIfGreater(Duration duration)
      Description copied from interface: RExpirable
      Sets a timeout for this object only if it's greater than timeout set before. After the timeout has expired, the key will automatically be deleted.

      Requires Redis 7.0.0 and higher.

      Specified by:
      expireIfGreater in interface RExpirable
      Parameters:
      duration - timeout before object will be deleted
      Returns:
      true if the timeout was set and false if not
    • expireIfGreaterAsync Link icon

      public RFuture<Boolean> expireIfGreaterAsync(Duration duration)
      Description copied from interface: RExpirableAsync
      Sets a timeout for this object only if it's greater than timeout set before. After the timeout has expired, the key will automatically be deleted.

      Requires Redis 7.0.0 and higher.

      Specified by:
      expireIfGreaterAsync in interface RExpirableAsync
      Parameters:
      duration - timeout before object will be deleted
      Returns:
      true if the timeout was set and false if not
    • expireIfLess Link icon

      public boolean expireIfLess(Duration duration)
      Description copied from interface: RExpirable
      Sets a timeout for this object only if it's less than timeout set before. After the timeout has expired, the key will automatically be deleted.

      Requires Redis 7.0.0 and higher.

      Specified by:
      expireIfLess in interface RExpirable
      Parameters:
      duration - timeout before object will be deleted
      Returns:
      true if the timeout was set and false if not
    • expireIfLessAsync Link icon

      public RFuture<Boolean> expireIfLessAsync(Duration duration)
      Description copied from interface: RExpirableAsync
      Sets a timeout for this object only if it's less than timeout set before. After the timeout has expired, the key will automatically be deleted.

      Requires Redis 7.0.0 and higher.

      Specified by:
      expireIfLessAsync in interface RExpirableAsync
      Parameters:
      duration - timeout before object will be deleted
      Returns:
      true if the timeout was set and false if not
    • clearExpire Link icon

      public boolean clearExpire()
      Description copied from interface: RExpirable
      Clear an expire timeout or expire date for object.
      Specified by:
      clearExpire in interface RExpirable
      Returns:
      true if timeout was removed false if object does not exist or does not have an associated timeout
    • remainTimeToLive Link icon

      public long remainTimeToLive()
      Description copied from interface: RExpirable
      Remaining time to live of Redisson object that has a timeout
      Specified by:
      remainTimeToLive in interface RExpirable
      Returns:
      time in milliseconds -2 if the key does not exist. -1 if the key exists but has no associated expire.
    • remainTimeToLiveAsync Link icon

      public RFuture<Long> remainTimeToLiveAsync()
      Description copied from interface: RExpirableAsync
      Remaining time to live of Redisson object that has a timeout
      Specified by:
      remainTimeToLiveAsync in interface RExpirableAsync
      Returns:
      time in milliseconds -2 if the key does not exist. -1 if the key exists but has no associated expire.
    • getExpireTime Link icon

      public long getExpireTime()
      Description copied from interface: RExpirable
      Expiration time of Redisson object that has a timeout

      Requires Redis 7.0.0 and higher.

      Specified by:
      getExpireTime in interface RExpirable
      Returns:
      expiration time
    • getExpireTimeAsync Link icon

      public RFuture<Long> getExpireTimeAsync()
      Description copied from interface: RExpirableAsync
      Expiration time of Redisson object that has a timeout

      Requires Redis 7.0.0 and higher.

      Specified by:
      getExpireTimeAsync in interface RExpirableAsync
      Returns:
      expiration time
    • clearExpireAsync Link icon

      protected RFuture<Boolean> clearExpireAsync(String... keys)