Package org.redisson

Class RedissonLocalCachedMap<K,​V>

    • Method Detail

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

        public  key)
        Description copied from interface: RMapAsync
        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.

        Specified by:
        getAsync in interface RMapAsync<K,​V>
        Overrides:
        getAsync in class RedissonMap<K,​V>
        Parameters:
        key - the key
        Returns:
        the value mapped by defined key or null if value is absent
      • generateLogEntryId

        protected static byte[] generateLogEntryId​(byte[] keyHash)
      • createSyncMessage

        protected io.netty.buffer.ByteBuf createSyncMessage​(io.netty.buffer.ByteBuf mapKey,
                                                            io.netty.buffer.ByteBuf mapValue,
                                                            CacheKey cacheKey)
      • destroy

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

        public <<K> keys)
        Description copied from interface: RMapAsync
        Returns map slice contained the mappings with defined keys.

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

        The returned map is NOT backed by the original map.

        Specified by:
        getAllAsync in interface RMapAsync<K,​V>
        Overrides:
        getAllAsync in class RedissonMap<K,​V>
        Parameters:
        keys - - map keys
        Returns:
        Map slice
      • fastPutIfAbsentAsync

        public > fastPutIfAbsentAsync​(K key,
                                                     V value)
        Description copied from interface: RMapAsync
        Stores the specified value mapped by specified key only if there is no value with specifiedkey stored before.

        Returns true if key is a new one in the hash and value was set or false if key already exists in the hash and change hasn't been made.

        Works faster than RMapAsync.putIfAbsentAsync(Object, Object) but not returning the previous value associated with key

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

        Specified by:
        fastPutIfAbsentAsync in interface RMapAsync<K,​V>
        Overrides:
        fastPutIfAbsentAsync in class RedissonMap<K,​V>
        Parameters:
        key - - map key
        value - - map value
        Returns:
        true if key is a new one in the hash and value was set. false if key already exists in the hash and change hasn't been made.
      • fastPutIfExistsAsync

        public > fastPutIfExistsAsync​(K key,
                                                     V value)
        Description copied from interface: RMapAsync
        Stores the specified value mapped by key only if mapping already exists.

        Returns true if key is a new one in the hash and value was set or false if key already exists in the hash and change hasn't been made.

        Works faster than RMapAsync.putIfExistsAsync(Object, Object) but doesn't return previous value associated with key

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

        Specified by:
        fastPutIfExistsAsync in interface RMapAsync<K,​V>
        Overrides:
        fastPutIfExistsAsync in class RedissonMap<K,​V>
        Parameters:
        key - - map key
        value - - map value
        Returns:
        true if key already exists in the hash and new value has been stored. false if key doesn't exist in the hash and value hasn't been set.
      • preloadCache

        public void preloadCache()
        Description copied from interface: RLocalCachedMap
        Pre-warm the cached entries. Not guaranteed to load ALL values, but statistically will preload approximately all (all if no concurrent mutating activity). Entries are loaded in a batch with size of 10 elements.
        Specified by:
        preloadCache in interface RLocalCachedMap<K,​V>
      • preloadCache

        public void preloadCache​(int count)
        Description copied from interface: RLocalCachedMap
        Pre-warm the cached entries. Not guaranteed to load ALL values, but statistically will preload approximately all (all if no concurrent mutating activity) Entries are loaded in a batch. Batch size is defined by count param.
        Specified by:
        preloadCache in interface RLocalCachedMap<K,​V>
        Parameters:
        count - - size of batch
      • fastReplaceAsync

        public > fastReplaceAsync​(K key,
                                                 V value)
        Description copied from interface: RMapAsync
        Replaces previous value with a new value mapped by specified key.

        Works faster than RMapAsync.replaceAsync(Object, Object) but not returning the previous value.

        Returns true if key exists and value was updated or false if key doesn't exists and value wasn't updated.

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

        Specified by:
        fastReplaceAsync in interface RMapAsync<K,​V>
        Overrides:
        fastReplaceAsync in class RedissonMap<K,​V>
        Parameters:
        key - - map key
        value - - map value
        Returns:
        true if key exists and value was updated. false if key doesn't exists and value wasn't updated.
      • replaceAsync

        public RFuture<V> replaceAsync​(K key,
                                       V value)
        Description copied from interface: RMapAsync
        Replaces previous value with a new value mapped by specified key. Returns null if there is no map entry stored before and doesn't store new map entry.

        If MapWriter is defined then new valueis written in write-through mode.

        Specified by:
        replaceAsync in interface RMapAsync<K,​V>
        Overrides:
        replaceAsync in class RedissonMap<K,​V>
        Parameters:
        key - - map key
        value - - map value
        Returns:
        previous associated value or null if there is no map entry stored before and doesn't store new map entry
      • replaceAsync

        public > replaceAsync​(K key,
                                             V oldValue,
                                             V newValue)
        Description copied from interface: RMapAsync
        Replaces previous oldValue with a newValue mapped by specified key. Returns false if previous value doesn't exist or equal to oldValue.

        If MapWriter is defined then newValueis written in write-through mode.

        Specified by:
        replaceAsync in interface RMapAsync<K,​V>
        Overrides:
        replaceAsync in class RedissonMap<K,​V>
        Parameters:
        key - - map key
        oldValue - - map old value
        newValue - - map new value
        Returns:
        true if value has been replaced otherwise false.
      • removeAsync

        public > removeAsync​( key,
                                             value)
        Description copied from interface: RMapAsync
        Removes map entry only if it exists with specified key and value.

        If MapWriter is defined then keyis deleted in write-through mode.

        Specified by:
        removeAsync in interface RMapAsync<K,​V>
        Overrides:
        removeAsync in class RedissonMap<K,​V>
        Parameters:
        key - - map key
        value - - map value
        Returns:
        true if map entry has been removed otherwise false.
      • putIfExistsAsync

        public RFuture<V> putIfExistsAsync​(K key,
                                           V value)
        Description copied from interface: RMapAsync
        Stores the specified value mapped by key only if mapping already exists.

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

        Specified by:
        putIfExistsAsync in interface RMapAsync<K,​V>
        Overrides:
        putIfExistsAsync in class RedissonMap<K,​V>
        Parameters:
        key - - map key
        value - - map value
        Returns:
        null if key is doesn't exists in the hash and value hasn't been set. Previous value if key already exists in the hash and new value has been stored.
      • putIfAbsentAsync

        public RFuture<V> putIfAbsentAsync​(K key,
                                           V value)
        Description copied from interface: RMapAsync
        Stores the specified value mapped by specified key only if there is no value with specifiedkey stored before.

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

        Specified by:
        putIfAbsentAsync in interface RMapAsync<K,​V>
        Overrides:
        putIfAbsentAsync in class RedissonMap<K,​V>
        Parameters:
        key - - map key
        value - - map value
        Returns:
        null if key is a new one in the hash and value was set. Previous value if key already exists in the hash and change hasn't been made.
      • encode

        public io.netty.buffer.ByteBuf encode​( value)
        Overrides:
        encode in class RedissonObject
      • 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
      • 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
        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
      • expireAsync

        public > expireAsync​( 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
      • 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
      • clearExpireAsync

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

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

        protected > expireAtAsync​(long timestamp,
                                                 ... keys)
      • clearExpireAsync

        protected > clearExpireAsync​(... keys)