Class RedissonTransactionalMapCache<K,​V>

    • Method Detail

      • expireAsync

        public > expireAsync​(long timeToLive,
                                             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
        Overrides:
        expireAsync in class RedissonMapCache<K,​V>
        Parameters:
        timeToLive - - timeout before object will be deleted
        timeUnit - - timeout time unit
        Returns:
        true if the timeout was set and false if not
      • expireAsync

        public > expireAsync​( timestamp)
        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:
        timestamp - - expire date
        Returns:
        true if the timeout was set and false if not
      • moveAsync

        public > 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

        public > migrateAsync​( 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
      • unlinkAsync

        public > 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
      • putIfAbsentAsync

        public RFuture<V> putIfAbsentAsync​(K key,
                                           V value,
                                           long ttl,
                                            ttlUnit,
                                           long maxIdleTime,
                                            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>
        Overrides:
        putIfAbsentAsync in class RedissonMapCache<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

        public RFuture<V> putOperationAsync​(K key,
                                            V value,
                                            long ttlTimeout,
                                            long maxIdleTimeout,
                                            long maxIdleDelta,
                                            long ttlTimeoutDelta)
        Overrides:
        putOperationAsync in class RedissonMapCache<K,​V>
      • fastPutIfAbsentAsync

        public > fastPutIfAbsentAsync​(K key,
                                                     V value,
                                                     long ttl,
                                                      ttlUnit,
                                                     long maxIdleTime,
                                                      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>
        Overrides:
        fastPutIfAbsentAsync in class RedissonMapCache<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
      • remainTimeToLiveAsync

        public > 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.
      • setMaxSizeAsync

        public > 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>
        Overrides:
        setMaxSizeAsync in class RedissonMapCache<K,​V>
        Parameters:
        maxSize - - max size
        Returns:
        void
      • trySetMaxSizeAsync

        public > 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>
        Overrides:
        trySetMaxSizeAsync in class RedissonMapCache<K,​V>
        Parameters:
        maxSize - - max size
        Returns:
        true if max size has been successfully set, otherwise false.
      • mapReduce

        public <KOut,​VOut> RMapReduce<K,​V,​KOut,​VOut> mapReduce()
        Description copied from interface: RMap
        Returns RMapReduce object associated with this map
        Specified by:
        mapReduce in interface RMap<K,​V>
        Overrides:
        mapReduce in class RedissonMap<K,​V>
        Type Parameters:
        KOut - output key
        VOut - output value
        Returns:
        MapReduce instance
      • containsKeyAsync

        public > containsKeyAsync​( 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 RedissonMapCache<K,​V>
        Parameters:
        key - - map key
        Returns:
        true if this map contains map entry mapped by specified key, otherwise false
      • containsValueAsync

        public > containsValueAsync​( 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 RedissonMapCache<K,​V>
        Parameters:
        value - - map value
        Returns:
        true if this map contains any map entry with specified value, otherwise false
      • valueSizeAsync

        public > valueSizeAsync​(K key)
        Description copied from interface: RMapAsync
        Returns size of value mapped by key in bytes
        Specified by:
        valueSizeAsync in interface RMapAsync<K,​V>
        Overrides:
        valueSizeAsync in class RedissonMap<K,​V>
        Parameters:
        key - - map key
        Returns:
        size of value
      • checkState

        protected void checkState()
      • loadAllAsync

        public > loadAllAsync​(boolean replaceExistingValues,
                                          int parallelism)
        Description copied from interface: RMapAsync
        Loads all map entries to this Redis map using MapLoader.
        Specified by:
        loadAllAsync in interface RMapAsync<K,​V>
        Overrides:
        loadAllAsync in class RedissonMap<K,​V>
        Parameters:
        replaceExistingValues - - true if existed values should be replaced, false otherwise.
        parallelism - - parallelism level, used to increase speed of process execution
        Returns:
        void
      • loadAllAsync

        public > loadAllAsync​(<? extends K> keys,
                                          boolean replaceExistingValues,
                                          int parallelism)
        Description copied from interface: RMapAsync
        Loads map entries using MapLoader whose keys are listed in defined keys parameter.
        Specified by:
        loadAllAsync in interface RMapAsync<K,​V>
        Overrides:
        loadAllAsync in class RedissonMap<K,​V>
        Parameters:
        keys - - map keys
        replaceExistingValues - - true if existed values should be replaced, false otherwise.
        parallelism - - parallelism level, used to increase speed of process execution
        Returns:
        void
      • getFairLock

        public RLock getFairLock​(K key)
        Description copied from interface: RMap
        Returns RLock instance associated with key
        Specified by:
        getFairLock in interface RMap<K,​V>
        Overrides:
        getFairLock in class RedissonMap<K,​V>
        Parameters:
        key - - map key
        Returns:
        fairlock
      • getSemaphore

        public RSemaphore getSemaphore​(K key)
        Description copied from interface: RMap
        Returns RSemaphore instance associated with key
        Specified by:
        getSemaphore in interface RMap<K,​V>
        Overrides:
        getSemaphore in class RedissonMap<K,​V>
        Parameters:
        key - - map key
        Returns:
        semaphore
      • getLock

        public RLock getLock​(K key)
        Description copied from interface: RMap
        Returns RLock instance associated with key
        Specified by:
        getLock in interface RMap<K,​V>
        Overrides:
        getLock in class RedissonMap<K,​V>
        Parameters:
        key - - map key
        Returns:
        lock
      • expire

        public boolean expire​(long timeToLive,
                               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)
        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
      • expireAt

        public boolean expireAt​( 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
      • 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.
      • expireAsync

        protected > expireAsync​(long timeToLive,
                                                timeUnit,
                                               ... keys)
      • clearExpireAsync

        protected > clearExpireAsync​(... keys)