Package org.redisson

Class RedissonMapCache<K,​V>

    • Method Detail

      • trySetMaxSize

        public boolean trySetMaxSize​(int maxSize)
        Description copied from interface: RMapCache
        Tries to set max size of the map. Superfluous elements are evicted using LRU algorithm.
        Specified by:
        trySetMaxSize in interface RMapCache<K,​V>
        Parameters:
        maxSize - - max size
        Returns:
        true if max size has been successfully set, otherwise false. If 0 the cache is unbounded (default).
      • trySetMaxSize

        public boolean trySetMaxSize​(int maxSize,
                                     EvictionMode mode)
        Description copied from interface: RMapCache
        Tries to set max size of the map. Superfluous elements are evicted using defined algorithm.
        Specified by:
        trySetMaxSize in interface RMapCache<K,​V>
        Parameters:
        maxSize - - max size
        mode - - eviction mode
        Returns:
        true if max size has been successfully set, otherwise false.
      • trySetMaxSizeAsync

        public RFuture<Boolean> trySetMaxSizeAsync​(int maxSize)
        Description copied from interface: RMapCacheAsync
        Tries to set max size of the map. Superfluous elements are evicted using LRU algorithm by default.
        Specified by:
        trySetMaxSizeAsync in interface RMapCacheAsync<K,​V>
        Parameters:
        maxSize - - max size
        Returns:
        true if max size has been successfully set, otherwise false.
      • trySetMaxSizeAsync

        public RFuture<Boolean> trySetMaxSizeAsync​(int maxSize,
                                                   EvictionMode mode)
        Description copied from interface: RMapCacheAsync
        Tries to set max size of the map. Superfluous elements are evicted using defined algorithm.
        Specified by:
        trySetMaxSizeAsync in interface RMapCacheAsync<K,​V>
        Parameters:
        maxSize - - max size
        mode - - eviction mode
        Returns:
        true if max size has been successfully set, otherwise false.
      • setMaxSize

        public void setMaxSize​(int maxSize)
        Description copied from interface: RMapCache
        Sets max size of the map and overrides current value. Superfluous elements are evicted using LRU algorithm.
        Specified by:
        setMaxSize in interface RMapCache<K,​V>
        Parameters:
        maxSize - - max size If 0 the cache is unbounded (default).
      • setMaxSize

        public void setMaxSize​(int maxSize,
                               EvictionMode mode)
        Description copied from interface: RMapCache
        Sets max size of the map and overrides current value. Superfluous elements are evicted using defined algorithm.
        Specified by:
        setMaxSize in interface RMapCache<K,​V>
        Parameters:
        maxSize - - max size
        mode - - eviction mode
      • setMaxSizeAsync

        public RFuture<Void> setMaxSizeAsync​(int maxSize)
        Description copied from interface: RMapCacheAsync
        Sets max size of the map and overrides current value. Superfluous elements are evicted using LRU algorithm by default.
        Specified by:
        setMaxSizeAsync in interface RMapCacheAsync<K,​V>
        Parameters:
        maxSize - - max size
        Returns:
        void
      • setMaxSizeAsync

        public RFuture<Void> setMaxSizeAsync​(int maxSize,
                                             EvictionMode mode)
        Description copied from interface: RMapCacheAsync
        Sets max size of the map and overrides current value. Superfluous elements are evicted using defined algorithm.
        Specified by:
        setMaxSizeAsync in interface RMapCacheAsync<K,​V>
        Parameters:
        maxSize - - max size
        mode - - eviction mode
        Returns:
        void
      • containsKeyAsync

        public RFuture<Boolean> containsKeyAsync​(Object key)
        Description copied from interface: RMapAsync
        Returns true if this map contains map entry mapped by specified key, otherwise false
        Specified by:
        containsKeyAsync in interface RMapAsync<K,​V>
        Overrides:
        containsKeyAsync in class RedissonMap<K,​V>
        Parameters:
        key - - map key
        Returns:
        true if this map contains map entry mapped by specified key, otherwise false
      • containsValueAsync

        public RFuture<Boolean> containsValueAsync​(Object value)
        Description copied from interface: RMapAsync
        Returns true if this map contains any map entry with specified value, otherwise false
        Specified by:
        containsValueAsync in interface RMapAsync<K,​V>
        Overrides:
        containsValueAsync in class RedissonMap<K,​V>
        Parameters:
        value - - map value
        Returns:
        true if this map contains any map entry with specified value, otherwise false
      • putIfAbsent

        public V putIfAbsent​(K key,
                             V value,
                             long ttl,
                             TimeUnit ttlUnit)
        Description copied from interface: RMapCache
        If the specified key is not already associated with a value, associate it with the given value.

        Stores value mapped by key with specified time to live. Entry expires after specified time to live.

        Specified by:
        putIfAbsent in interface RMapCache<K,​V>
        Parameters:
        key - - map key
        value - - map value
        ttl - - time to live for key\value entry. If 0 then stores infinitely.
        ttlUnit - - time unit
        Returns:
        current associated value
      • putIfAbsentAsync

        public RFuture<V> putIfAbsentAsync​(K key,
                                           V value,
                                           long ttl,
                                           TimeUnit ttlUnit)
        Description copied from interface: RMapCacheAsync
        If the specified key is not already associated with a value, associate it with the given value.

        Stores value mapped by key with specified time to live. Entry expires after specified time to live. If the map previously contained a mapping for the key, the old value is replaced by the specified value.

        Specified by:
        putIfAbsentAsync in interface RMapCacheAsync<K,​V>
        Parameters:
        key - - map key
        value - - map value
        ttl - - time to live for key\value entry. If 0 then stores infinitely.
        ttlUnit - - time unit
        Returns:
        previous associated value
      • putIfAbsent

        public V putIfAbsent​(K key,
                             V value,
                             long ttl,
                             TimeUnit ttlUnit,
                             long maxIdleTime,
                             TimeUnit maxIdleUnit)
        Description copied from interface: RMapCache
        If the specified key is not already associated with a value, associate it with the given value.

        Stores value mapped by key with specified time to live and max idle time. Entry expires when specified time to live or max idle time has expired.

        Specified by:
        putIfAbsent in interface RMapCache<K,​V>
        Parameters:
        key - - map key
        value - - map value
        ttl - - time to live for key\value entry. If 0 then time to live doesn't affect entry expiration.
        ttlUnit - - time unit
        maxIdleTime - - max idle time for key\value entry. If 0 then max idle time doesn't affect entry expiration.
        maxIdleUnit - - time unit

        if maxIdleTime and ttl params are equal to 0 then entry stores infinitely.

        Returns:
        current associated value
      • putIfAbsentAsync

        public RFuture<V> putIfAbsentAsync​(K key,
                                           V value,
                                           long ttl,
                                           TimeUnit ttlUnit,
                                           long maxIdleTime,
                                           TimeUnit maxIdleUnit)
        Description copied from interface: RMapCacheAsync
        If the specified key is not already associated with a value, associate it with the given value.

        Stores value mapped by key with specified time to live and max idle time. Entry expires when specified time to live or max idle time has expired.

        If the map previously contained a mapping for the key, the old value is replaced by the specified value.

        Specified by:
        putIfAbsentAsync in interface RMapCacheAsync<K,​V>
        Parameters:
        key - - map key
        value - - map value
        ttl - - time to live for key\value entry. If 0 then time to live doesn't affect entry expiration.
        ttlUnit - - time unit
        maxIdleTime - - max idle time for key\value entry. If 0 then max idle time doesn't affect entry expiration.
        maxIdleUnit - - time unit

        if maxIdleTime and ttl params are equal to 0 then entry stores infinitely.

        Returns:
        previous associated value
      • put

        public V put​(K key,
                     V value,
                     long ttl,
                     TimeUnit unit)
        Description copied from interface: RMapCache
        Stores value mapped by key with specified time to live. Entry expires after specified time to live.

        If the map previously contained a mapping for the key, the old value is replaced by the specified value.

        Specified by:
        put in interface RMapCache<K,​V>
        Parameters:
        key - - map key
        value - - map value
        ttl - - time to live for key\value entry. If 0 then stores infinitely.
        unit - - time unit
        Returns:
        previous associated value
      • putAll

        public void putAll​(Map<? extends K,​? extends V> map,
                           long ttl,
                           TimeUnit ttlUnit)
        Description copied from interface: RMapCache
        Associates the specified value with the specified key in batch.

        If MapWriter is defined then new map entries will be stored in write-through mode.

        Specified by:
        putAll in interface RMapCache<K,​V>
        Parameters:
        map - - mappings to be stored in this map
        ttl - - time to live for all key\value entries. If 0 then stores infinitely.
        ttlUnit - - time unit
      • putAllAsync

        public RFuture<Void> putAllAsync​(Map<? extends K,​? extends V> map,
                                         long ttl,
                                         TimeUnit ttlUnit)
        Description copied from interface: RMapCacheAsync
        Associates the specified value with the specified key in batch.

        If MapWriter is defined then new map entries are stored in write-through mode.

        Specified by:
        putAllAsync in interface RMapCacheAsync<K,​V>
        Parameters:
        map - - mappings to be stored in this map
        ttl - - time to live for all key\value entries. If 0 then stores infinitely.
        ttlUnit - - time unit
        Returns:
        void
      • addAndGet

        public V addAndGet​(K key,
                           Number value)
        Description copied from interface: RMap
        Adds the given delta to the current value by mapped key. Works only for numeric values!
        Specified by:
        addAndGet in interface RMap<K,​V>
        Overrides:
        addAndGet in class RedissonMap<K,​V>
        Parameters:
        key - - map key
        value - the value to add
        Returns:
        the updated value
      • fastPut

        public boolean fastPut​(K key,
                               V value,
                               long ttl,
                               TimeUnit ttlUnit)
        Description copied from interface: RMapCache
        Stores value mapped by key with specified time to live. Entry expires after specified time to live.

        If the map previously contained a mapping for the key, the old value is replaced by the specified value.

        Works faster than usual RMapCache.put(Object, Object, long, TimeUnit) as it not returns previous value.

        Specified by:
        fastPut in interface RMapCache<K,​V>
        Parameters:
        key - - map key
        value - - map value
        ttl - - time to live for key\value entry. If 0 then stores infinitely.
        ttlUnit - - time unit
        Returns:
        true if key is a new key in the hash and value was set. false if key already exists in the hash and the value was updated.
      • fastPutAsync

        public RFuture<Boolean> fastPutAsync​(K key,
                                             V value,
                                             long ttl,
                                             TimeUnit ttlUnit)
        Description copied from interface: RMapCacheAsync
        Stores value mapped by key with specified time to live. Entry expires after specified time to live.

        If the map previously contained a mapping for the key, the old value is replaced by the specified value.

        Works faster than usual RMapCacheAsync.putAsync(Object, Object, long, TimeUnit) as it not returns previous value.

        Specified by:
        fastPutAsync in interface RMapCacheAsync<K,​V>
        Parameters:
        key - - map key
        value - - map value
        ttl - - time to live for key\value entry. If 0 then stores infinitely.
        ttlUnit - - time unit
        Returns:
        true if key is a new key in the hash and value was set. false if key already exists in the hash and the value was updated.
      • fastPut

        public boolean fastPut​(K key,
                               V value,
                               long ttl,
                               TimeUnit ttlUnit,
                               long maxIdleTime,
                               TimeUnit maxIdleUnit)
        Description copied from interface: RMapCache
        Stores value mapped by key with specified time to live and max idle time. Entry expires when specified time to live or max idle time has expired.

        If the map previously contained a mapping for the key, the old value is replaced by the specified value.

        Works faster than usual RMapCache.put(Object, Object, long, TimeUnit, long, TimeUnit) as it not returns previous value.

        Specified by:
        fastPut in interface RMapCache<K,​V>
        Parameters:
        key - - map key
        value - - map value
        ttl - - time to live for key\value entry. If 0 then time to live doesn't affect entry expiration.
        ttlUnit - - time unit
        maxIdleTime - - max idle time for key\value entry. If 0 then max idle time doesn't affect entry expiration.
        maxIdleUnit - - time unit

        if maxIdleTime and ttl params are equal to 0 then entry stores infinitely.

        Returns:
        true if key is a new key in the hash and value was set. false if key already exists in the hash and the value was updated.
      • fastPutAsync

        public RFuture<Boolean> fastPutAsync​(K key,
                                             V value,
                                             long ttl,
                                             TimeUnit ttlUnit,
                                             long maxIdleTime,
                                             TimeUnit maxIdleUnit)
        Description copied from interface: RMapCacheAsync
        Stores value mapped by key with specified time to live and max idle time. Entry expires when specified time to live or max idle time has expired.

        If the map previously contained a mapping for the key, the old value is replaced by the specified value.

        Works faster than usual RMapCacheAsync.putAsync(Object, Object, long, TimeUnit, long, TimeUnit) as it not returns previous value.

        Specified by:
        fastPutAsync in interface RMapCacheAsync<K,​V>
        Parameters:
        key - - map key
        value - - map value
        ttl - - time to live for key\value entry. If 0 then time to live doesn't affect entry expiration.
        ttlUnit - - time unit
        maxIdleTime - - max idle time for key\value entry. If 0 then max idle time doesn't affect entry expiration.
        maxIdleUnit - - time unit

        if maxIdleTime and ttl params are equal to 0 then entry stores infinitely.

        Returns:
        true if key is a new key in the hash and value was set. false if key already exists in the hash and the value was updated.
      • fastPutOperationAsync

        protected RFuture<Boolean> fastPutOperationAsync​(K key,
                                                         V value,
                                                         long ttl,
                                                         TimeUnit ttlUnit,
                                                         long maxIdleTime,
                                                         TimeUnit maxIdleUnit)
      • updateEntryExpiration

        public boolean updateEntryExpiration​(K key,
                                             long ttl,
                                             TimeUnit ttlUnit,
                                             long maxIdleTime,
                                             TimeUnit maxIdleUnit)
        Description copied from interface: RMapCache
        Updates time to live and max idle time of specified entry by key. Entry expires when specified time to live or max idle time was reached.

        Returns false if entry already expired or doesn't exist, otherwise returns true.

        Specified by:
        updateEntryExpiration in interface RMapCache<K,​V>
        Parameters:
        key - - map key
        ttl - - time to live for key\value entry. If 0 then time to live doesn't affect entry expiration.
        ttlUnit - - time unit
        maxIdleTime - - max idle time for key\value entry. If 0 then max idle time doesn't affect entry expiration.
        maxIdleUnit - - time unit

        if maxIdleTime and ttl params are equal to 0 then entry stores infinitely.

        Returns:
        returns false if entry already expired or doesn't exist, otherwise returns true.
      • updateEntryExpirationAsync

        public RFuture<Boolean> updateEntryExpirationAsync​(K key,
                                                           long ttl,
                                                           TimeUnit ttlUnit,
                                                           long maxIdleTime,
                                                           TimeUnit maxIdleUnit)
        Description copied from interface: RMapCacheAsync
        Updates time to live and max idle time of specified entry by key. Entry expires when specified time to live or max idle time was reached.

        Returns false if entry already expired or doesn't exist, otherwise returns true.

        Specified by:
        updateEntryExpirationAsync in interface RMapCacheAsync<K,​V>
        Parameters:
        key - - map key
        ttl - - time to live for key\value entry. If 0 then time to live doesn't affect entry expiration.
        ttlUnit - - time unit
        maxIdleTime - - max idle time for key\value entry. If 0 then max idle time doesn't affect entry expiration.
        maxIdleUnit - - time unit

        if maxIdleTime and ttl params are equal to 0 then entry stores infinitely.

        Returns:
        returns false if entry already expired or doesn't exist, otherwise returns true.
      • putAsync

        public RFuture<V> putAsync​(K key,
                                   V value,
                                   long ttl,
                                   TimeUnit ttlUnit)
        Description copied from interface: RMapCacheAsync
        Stores value mapped by key with specified time to live. Entry expires after specified time to live. If the map previously contained a mapping for the key, the old value is replaced by the specified value.
        Specified by:
        putAsync in interface RMapCacheAsync<K,​V>
        Parameters:
        key - - map key
        value - - map value
        ttl - - time to live for key\value entry. If 0 then stores infinitely.
        ttlUnit - - time unit
        Returns:
        previous associated value
      • put

        public V put​(K key,
                     V value,
                     long ttl,
                     TimeUnit ttlUnit,
                     long maxIdleTime,
                     TimeUnit maxIdleUnit)
        Description copied from interface: RMapCache
        Stores value mapped by key with specified time to live and max idle time. Entry expires when specified time to live or max idle time has expired.

        If the map previously contained a mapping for the key, the old value is replaced by the specified value.

        Specified by:
        put in interface RMapCache<K,​V>
        Parameters:
        key - - map key
        value - - map value
        ttl - - time to live for key\value entry. If 0 then time to live doesn't affect entry expiration.
        ttlUnit - - time unit
        maxIdleTime - - max idle time for key\value entry. If 0 then max idle time doesn't affect entry expiration.
        maxIdleUnit - - time unit

        if maxIdleTime and ttl params are equal to 0 then entry stores infinitely.

        Returns:
        previous associated value
      • putAsync

        public RFuture<V> putAsync​(K key,
                                   V value,
                                   long ttl,
                                   TimeUnit ttlUnit,
                                   long maxIdleTime,
                                   TimeUnit maxIdleUnit)
        Description copied from interface: RMapCacheAsync
        Stores value mapped by key with specified time to live and max idle time. Entry expires when specified time to live or max idle time has expired.

        If the map previously contained a mapping for the key, the old value is replaced by the specified value.

        Specified by:
        putAsync in interface RMapCacheAsync<K,​V>
        Parameters:
        key - - map key
        value - - map value
        ttl - - time to live for key\value entry. If 0 then time to live doesn't affect entry expiration.
        ttlUnit - - time unit
        maxIdleTime - - max idle time for key\value entry. If 0 then max idle time doesn't affect entry expiration.
        maxIdleUnit - - time unit

        if maxIdleTime and ttl params are equal to 0 then entry stores infinitely.

        Returns:
        previous associated value
      • putOperationAsync

        protected RFuture<V> putOperationAsync​(K key,
                                               V value,
                                               long ttlTimeout,
                                               long maxIdleTimeout,
                                               long maxIdleDelta,
                                               long ttlTimeoutDelta)
      • getWithTTLOnly

        public V getWithTTLOnly​(K key)
        Description copied from interface: RMapCache
        Returns the value mapped by defined key or null if value is absent.

        If map doesn't contain value for specified key and MapLoader is defined then value will be loaded in read-through mode.

        Idle time of entry is not taken into account. Entry last access time isn't modified if map limited by size.

        Specified by:
        getWithTTLOnly in interface RMapCache<K,​V>
        Parameters:
        key - the key
        Returns:
        the value mapped by defined key or null if value is absent
      • getWithTTLOnlyAsync

        public RFuture<V> getWithTTLOnlyAsync​(K key)
        Description copied from interface: RMapCacheAsync
        Returns the value mapped by defined key or null if value is absent.

        If map doesn't contain value for specified key and MapLoader is defined then value will be loaded in read-through mode.

        Idle time of entry is not taken into account. Entry last access time isn't modified if map limited by size.

        Specified by:
        getWithTTLOnlyAsync in interface RMapCacheAsync<K,​V>
        Parameters:
        key - the key
        Returns:
        the value mapped by defined key or null if value is absent
      • remainTimeToLive

        public long remainTimeToLive​(K key)
        Description copied from interface: RMapCache
        Remaining time to live of map entry associated with a key.
        Specified by:
        remainTimeToLive in interface RMapCache<K,​V>
        Parameters:
        key - - map key
        Returns:
        time in milliseconds -2 if the key does not exist. -1 if the key exists but has no associated expire.
      • remainTimeToLiveAsync

        public RFuture<Long> remainTimeToLiveAsync​(K key)
        Description copied from interface: RMapCacheAsync
        Remaining time to live of map entry associated with a key.
        Specified by:
        remainTimeToLiveAsync in interface RMapCacheAsync<K,​V>
        Parameters:
        key - - map key
        Returns:
        time in milliseconds -2 if the key does not exist. -1 if the key exists but has no associated expire.
      • fastPutIfAbsent

        public boolean fastPutIfAbsent​(K key,
                                       V value,
                                       long ttl,
                                       TimeUnit ttlUnit)
        Description copied from interface: RMapCache
        If the specified key is not already associated with a value, associate it with the given value.

        Stores value mapped by key with specified time to live. Entry expires after specified time to live.

        Works faster than usual RMapCache.putIfAbsent(Object, Object, long, TimeUnit) as it not returns previous value.

        Specified by:
        fastPutIfAbsent in interface RMapCache<K,​V>
        Parameters:
        key - - map key
        value - - map value
        ttl - - time to live for key\value entry. If 0 then stores infinitely.
        ttlUnit - - time unit
        Returns:
        true if key is a new key in the hash and value was set. false if key already exists in the hash
      • fastPutIfAbsent

        public boolean fastPutIfAbsent​(K key,
                                       V value,
                                       long ttl,
                                       TimeUnit ttlUnit,
                                       long maxIdleTime,
                                       TimeUnit maxIdleUnit)
        Description copied from interface: RMapCache
        If the specified key is not already associated with a value, associate it with the given value.

        Stores value mapped by key with specified time to live and max idle time. Entry expires when specified time to live or max idle time has expired.

        Works faster than usual RMapCache.putIfAbsent(Object, Object, long, TimeUnit, long, TimeUnit) as it not returns previous value.

        Specified by:
        fastPutIfAbsent in interface RMapCache<K,​V>
        Parameters:
        key - - map key
        value - - map value
        ttl - - time to live for key\value entry. If 0 then time to live doesn't affect entry expiration.
        ttlUnit - - time unit
        maxIdleTime - - max idle time for key\value entry. If 0 then max idle time doesn't affect entry expiration.
        maxIdleUnit - - time unit

        if maxIdleTime and ttl params are equal to 0 then entry stores infinitely.

        Returns:
        true if key is a new key in the hash and value was set. false if key already exists in the hash.
      • fastPutIfAbsentAsync

        public RFuture<Boolean> fastPutIfAbsentAsync​(K key,
                                                     V value,
                                                     long ttl,
                                                     TimeUnit ttlUnit,
                                                     long maxIdleTime,
                                                     TimeUnit maxIdleUnit)
        Description copied from interface: RMapCacheAsync
        If the specified key is not already associated with a value, associate it with the given value.

        Stores value mapped by key with specified time to live and max idle time. Entry expires when specified time to live or max idle time has expired.

        Works faster than usual RMapCacheAsync.putIfAbsentAsync(Object, Object, long, TimeUnit, long, TimeUnit) as it not returns previous value.

        Specified by:
        fastPutIfAbsentAsync in interface RMapCacheAsync<K,​V>
        Parameters:
        key - - map key
        value - - map value
        ttl - - time to live for key\value entry. If 0 then time to live doesn't affect entry expiration.
        ttlUnit - - time unit
        maxIdleTime - - max idle time for key\value entry. If 0 then max idle time doesn't affect entry expiration.
        maxIdleUnit - - time unit

        if maxIdleTime and ttl params are equal to 0 then entry stores infinitely.

        Returns:
        true if key is a new key in the hash and value was set. false if key already exists in the hash
      • expireAsync

        public RFuture<Boolean> expireAsync​(long timeToLive,
                                            TimeUnit timeUnit)
        Description copied from interface: RExpirableAsync
        Set a timeout for object in async mode. After the timeout has expired, the key will automatically be deleted.
        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
      • clearExpireAsync

        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
      • destroy

        public void destroy()
        Description copied from interface: RDestroyable
        Destroys object when it's not necessary anymore.
        Specified by:
        destroy in interface RDestroyable
      • expire

        public boolean expire​(long timeToLive,
                              TimeUnit timeUnit)
        Description copied from interface: RExpirable
        Set a timeout for object. After the timeout has expired, the key will automatically be deleted.
        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
      • expireAt

        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
      • expire

        public boolean expire​(Instant instant)
        Description copied from interface: RExpirable
        Set an expire date for 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
      • expireAsync

        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
      • clearExpire

        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

        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

        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.