Package org.redisson

Class RedissonMap<K,​V>

    • Method Detail

      • 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>
        Type Parameters:
        KOut - output key
        VOut - output value
        Returns:
        MapReduce instance
      • getPermitExpirableSemaphore

        public RPermitExpirableSemaphore getPermitExpirableSemaphore​(K key)
        Description copied from interface: RMap
        Returns RPermitExpirableSemaphore instance associated with key
        Specified by:
        getPermitExpirableSemaphore in interface RMap<K,​V>
        Parameters:
        key - - map key
        Returns:
        permitExpirableSemaphore
      • 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>
        Parameters:
        key - - map key
        Returns:
        semaphore
      • getCountDownLatch

        public RCountDownLatch getCountDownLatch​(K key)
        Description copied from interface: RMap
        Returns RCountDownLatch instance associated with key
        Specified by:
        getCountDownLatch in interface RMap<K,​V>
        Parameters:
        key - - map key
        Returns:
        countdownlatch
      • 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>
        Parameters:
        key - - map key
        Returns:
        fairlock
      • 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>
        Parameters:
        key - - map key
        Returns:
        lock
      • getReadWriteLock

        public RReadWriteLock getReadWriteLock​(K key)
        Description copied from interface: RMap
        Returns RReadWriteLock instance associated with key
        Specified by:
        getReadWriteLock in interface RMap<K,​V>
        Parameters:
        key - - map key
        Returns:
        readWriteLock
      • size

        public int size()
        Specified by:
        size in interface Map<K,​V>
      • mergeAsync

        public RFuture<V> mergeAsync​(K key,
                                     V value,
                                     BiFunction<? super V,​? super V,​? extends V> remappingFunction)
        Description copied from interface: RMapAsync
        Associates specified key with the given value if key isn't already associated with a value. Otherwise, replaces the associated value with the results of the given remapping function, or removes if the result is null.
        Specified by:
        mergeAsync in interface RMapAsync<K,​V>
        Parameters:
        key - - map key
        value - - value to be merged with the existing value associated with the key or to be associated with the key, if no existing value
        remappingFunction - - the function is invoked with the existing value to compute new value
        Returns:
        new value associated with the specified key or null if no value associated with the key
      • computeAsync

        public RFuture<V> computeAsync​(K key,
                                       BiFunction<? super K,​? super V,​? extends V> remappingFunction)
        Description copied from interface: RMapAsync
        Computes a new mapping for the specified key and its current mapped value.
        Specified by:
        computeAsync in interface RMapAsync<K,​V>
        Parameters:
        key - - map key
        remappingFunction - - function to compute a value
        Returns:
        the new value associated with the specified key, or null if none
      • computeIfAbsentAsync

        public RFuture<V> computeIfAbsentAsync​(K key,
                                               Function<? super K,​? extends V> mappingFunction)
        Description copied from interface: RMapAsync
        Computes a mapping for the specified key if it's not mapped before.
        Specified by:
        computeIfAbsentAsync in interface RMapAsync<K,​V>
        Parameters:
        key - - map key
        mappingFunction - - function to compute a value
        Returns:
        current or new computed value associated with the specified key, or null if the computed value is null
      • computeIfPresentAsync

        public RFuture<V> computeIfPresentAsync​(K key,
                                                BiFunction<? super K,​? super V,​? extends V> remappingFunction)
        Description copied from interface: RMapAsync
        Computes a mapping for the specified key only if it's already mapped.
        Specified by:
        computeIfPresentAsync in interface RMapAsync<K,​V>
        Parameters:
        key - - map key
        remappingFunction - - function to compute a value
        Returns:
        the new value associated with the specified key, or null if none
      • valueSize

        public int valueSize​(K key)
        Description copied from interface: RMap
        Returns size of value mapped by specified key in bytes
        Specified by:
        valueSize in interface RMap<K,​V>
        Parameters:
        key - - map key
        Returns:
        size of value
      • valueSizeAsync

        public RFuture<Integer> 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>
        Parameters:
        key - - map key
        Returns:
        size of value
      • checkKey

        protected void checkKey​(Object key)
      • isEmpty

        public boolean isEmpty()
        Specified by:
        isEmpty in interface Map<K,​V>
      • containsKey

        public boolean containsKey​(Object key)
        Description copied from interface: RMap
        Returns true if this map contains map entry mapped by specified key, otherwise false
        Specified by:
        containsKey in interface Map<K,​V>
        Specified by:
        containsKey in interface RMap<K,​V>
        Parameters:
        key - - map key
        Returns:
        true if this map contains map entry mapped by specified key, otherwise false
      • 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>
        Parameters:
        key - - map key
        Returns:
        true if this map contains map entry mapped by specified key, otherwise false
      • containsValue

        public boolean containsValue​(Object value)
        Description copied from interface: RMap
        Returns true if this map contains any map entry with specified value, otherwise false
        Specified by:
        containsValue in interface Map<K,​V>
        Specified by:
        containsValue in interface RMap<K,​V>
        Parameters:
        value - - map value
        Returns:
        true if this map contains any map entry with specified value, 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>
        Parameters:
        value - - map value
        Returns:
        true if this map contains any map entry with specified value, otherwise false
      • getAll

        public Map<K,​V> getAll​(Set<K> keys)
        Description copied from interface: RMap
        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:
        getAll in interface RMap<K,​V>
        Parameters:
        keys - - map keys
        Returns:
        Map slice
      • randomKeys

        public Set<K> randomKeys​(int count)
        Description copied from interface: RMap
        Returns random keys from this map limited by count
        Specified by:
        randomKeys in interface RMap<K,​V>
        Parameters:
        count - - keys amount to return
        Returns:
        random keys
      • randomEntries

        public Map<K,​V> randomEntries​(int count)
        Description copied from interface: RMap
        Returns random map entries from this map limited by count
        Specified by:
        randomEntries in interface RMap<K,​V>
        Parameters:
        count - - entries amount to return
        Returns:
        random entries
      • randomKeysAsync

        public RFuture<Set<K>> randomKeysAsync​(int count)
        Description copied from interface: RMapAsync
        Returns random keys from this map limited by count
        Specified by:
        randomKeysAsync in interface RMapAsync<K,​V>
        Parameters:
        count - - keys amount to return
        Returns:
        random keys
      • randomEntriesAsync

        public RFuture<Map<K,​V>> randomEntriesAsync​(int count)
        Description copied from interface: RMapAsync
        Returns random map entries from this map limited by count
        Specified by:
        randomEntriesAsync in interface RMapAsync<K,​V>
        Parameters:
        count - - entries amount to return
        Returns:
        random entries
      • getAllAsync

        public RFuture<Map<K,​V>> getAllAsync​(Set<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>
        Parameters:
        keys - - map keys
        Returns:
        Map slice
      • hasNoLoader

        protected boolean hasNoLoader()
      • getAllOperationAsync

        public RFuture<Map<K,​V>> getAllOperationAsync​(Set<K> keys)
      • get

        public V get​(Object key)
        Description copied from interface: RMap
        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:
        get in interface Map<K,​V>
        Specified by:
        get in interface RMap<K,​V>
        Parameters:
        key - the key
        Returns:
        the value mapped by defined key or null if value is absent
      • put

        public V put​(K key,
                     V value)
        Description copied from interface: RMap
        Stores the specified value mapped by specified key. Returns previous value if map entry with specified key already existed.

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

        Specified by:
        put in interface Map<K,​V>
        Specified by:
        put in interface RMap<K,​V>
        Parameters:
        key - - map key
        value - - map value
        Returns:
        previous associated value
      • remove

        public V remove​(Object key)
        Description copied from interface: RMap
        Removes map entry by specified key and returns value.

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

        Specified by:
        remove in interface Map<K,​V>
        Specified by:
        remove in interface RMap<K,​V>
        Parameters:
        key - - map key
        Returns:
        deleted value, null if map entry doesn't exist
      • putAll

        public final void putAll​(Map<? extends K,​? extends V> map)
        Description copied from interface: RMap
        Stores map entries specified in map object in batch mode.

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

        Specified by:
        putAll in interface Map<K,​V>
        Specified by:
        putAll in interface RMap<K,​V>
        Parameters:
        map - mappings to be stored in this map
      • putAll

        public void putAll​(Map<? extends K,​? extends V> map,
                           int batchSize)
        Description copied from interface: RMap
        Stores map entries specified in map object in batch mode. Batch inserted by chunks limited by batchSize value to avoid OOM and/or Redis response timeout error for map with big size.

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

        Specified by:
        putAll in interface RMap<K,​V>
        Parameters:
        map - mappings to be stored in this map
        batchSize - - size of map entries batch
      • putAllAsync

        public RFuture<Void> putAllAsync​(Map<? extends K,​? extends V> map,
                                         int batchSize)
        Description copied from interface: RMapAsync
        Stores map entries specified in map object in batch mode. Batch inserted by chunks limited by batchSize value to avoid OOM and/or Redis response timeout error for map with big size.

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

        Specified by:
        putAllAsync in interface RMapAsync<K,​V>
        Parameters:
        map - mappings to be stored in this map
        batchSize - - size of map entries batch
        Returns:
        void
      • putAllAsync

        public final RFuture<Void> putAllAsync​(Map<? extends K,​? extends V> map)
        Description copied from interface: RMapAsync
        Stores map entries specified in map object in batch mode.

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

        Specified by:
        putAllAsync in interface RMapAsync<K,​V>
        Parameters:
        map - mappings to be stored in this map
        Returns:
        void
      • putAllOperationAsync

        protected RFuture<Void> putAllOperationAsync​(Map<? extends K,​? extends V> map)
      • clear

        public void clear()
        Specified by:
        clear in interface Map<K,​V>
      • keySet

        public Set<K> keySet()
        Description copied from interface: RMap
        Returns key set of this map. Keys are loaded in batch. Batch size is 10.
        Specified by:
        keySet in interface Map<K,​V>
        Specified by:
        keySet in interface RMap<K,​V>
        Returns:
        key set
        See Also:
        RMap.readAllKeySet()
      • keySet

        public Set<K> keySet​(String pattern)
        Description copied from interface: RMap
        Returns key set of this map. If pattern is not null then only keys match this pattern are loaded.

        Use org.redisson.client.codec.StringCodec for Map keys.

        Supported glob-style patterns:

        h?llo subscribes to hello, hallo and hxllo

        h*llo subscribes to hllo and heeeello

        h[ae]llo subscribes to hello and hallo, but not hillo

        Specified by:
        keySet in interface RMap<K,​V>
        Parameters:
        pattern - - key pattern
        Returns:
        key set
        See Also:
        RMap.readAllKeySet()
      • keySet

        public Set<K> keySet​(String pattern,
                             int count)
        Description copied from interface: RMap
        Returns key set of this map. If pattern is not null then only keys match this pattern are loaded. Keys are loaded in batch. Batch size is defined by count param.

        Use org.redisson.client.codec.StringCodec for Map keys.

        Supported glob-style patterns:

        h?llo subscribes to hello, hallo and hxllo

        h*llo subscribes to hllo and heeeello

        h[ae]llo subscribes to hello and hallo, but not hillo

        Specified by:
        keySet in interface RMap<K,​V>
        Parameters:
        pattern - - key pattern
        count - - size of keys batch
        Returns:
        key set
        See Also:
        RMap.readAllKeySet()
      • keySet

        public Set<K> keySet​(int count)
        Description copied from interface: RMap
        Returns key set of this map. Keys are loaded in batch. Batch size is defined by count param.
        Specified by:
        keySet in interface RMap<K,​V>
        Parameters:
        count - - size of keys batch
        Returns:
        key set
        See Also:
        RMap.readAllKeySet()
      • values

        public Collection<V> values()
        Description copied from interface: RMap
        Returns values collection of this map. Values are loaded in batch. Batch size is 10.
        Specified by:
        values in interface Map<K,​V>
        Specified by:
        values in interface RMap<K,​V>
        Returns:
        values collection
        See Also:
        RMap.readAllValues()
      • values

        public Collection<V> values​(String keyPattern,
                                    int count)
        Description copied from interface: RMap
        Returns values collection of this map. Values are loaded in batch. Batch size is defined by count param. If keyPattern is not null then only values mapped by matched keys of this pattern are loaded.

        Use org.redisson.client.codec.StringCodec for Map keys.

        Supported glob-style patterns:

        h?llo subscribes to hello, hallo and hxllo

        h*llo subscribes to hllo and heeeello

        h[ae]llo subscribes to hello and hallo, but not hillo

        Specified by:
        values in interface RMap<K,​V>
        Parameters:
        keyPattern - - key pattern
        count - - size of values batch
        Returns:
        values collection
        See Also:
        RMap.readAllValues()
      • values

        public Collection<V> values​(String keyPattern)
        Description copied from interface: RMap
        Returns values collection of this map. Values are loaded in batch. Batch size is 10. If keyPattern is not null then only values mapped by matched keys of this pattern are loaded.

        Use org.redisson.client.codec.StringCodec for Map keys.

        Supported glob-style patterns:

        h?llo subscribes to hello, hallo and hxllo

        h*llo subscribes to hllo and heeeello

        h[ae]llo subscribes to hello and hallo, but not hillo

        Specified by:
        values in interface RMap<K,​V>
        Parameters:
        keyPattern - - key pattern
        Returns:
        values collection
        See Also:
        RMap.readAllValues()
      • values

        public Collection<V> values​(int count)
        Description copied from interface: RMap
        Returns values collection of this map. Values are loaded in batch. Batch size is defined by count param.
        Specified by:
        values in interface RMap<K,​V>
        Parameters:
        count - - size of values batch
        Returns:
        values collection
        See Also:
        RMap.readAllValues()
      • entrySet

        public Set<Map.Entry<K,​V>> entrySet()
        Description copied from interface: RMap
        Returns map entries collection. Map entries are loaded in batch. Batch size is 10.
        Specified by:
        entrySet in interface Map<K,​V>
        Specified by:
        entrySet in interface RMap<K,​V>
        Returns:
        map entries collection
        See Also:
        RMap.readAllEntrySet()
      • entrySet

        public Set<Map.Entry<K,​V>> entrySet​(String keyPattern)
        Description copied from interface: RMap
        Returns map entries collection. Map entries are loaded in batch. Batch size is 10. If keyPattern is not null then only entries mapped by matched keys of this pattern are loaded. Supported glob-style patterns:

        h?llo subscribes to hello, hallo and hxllo

        h*llo subscribes to hllo and heeeello

        h[ae]llo subscribes to hello and hallo, but not hillo

        Specified by:
        entrySet in interface RMap<K,​V>
        Parameters:
        keyPattern - - key pattern
        Returns:
        map entries collection
        See Also:
        RMap.readAllEntrySet()
      • entrySet

        public Set<Map.Entry<K,​V>> entrySet​(String keyPattern,
                                                  int count)
        Description copied from interface: RMap
        Returns map entries collection. Map entries are loaded in batch. Batch size is defined by count param. If keyPattern is not null then only entries mapped by matched keys of this pattern are loaded. Supported glob-style patterns:

        h?llo subscribes to hello, hallo and hxllo

        h*llo subscribes to hllo and heeeello

        h[ae]llo subscribes to hello and hallo, but not hillo

        Specified by:
        entrySet in interface RMap<K,​V>
        Parameters:
        keyPattern - - key pattern
        count - - size of entries batch
        Returns:
        map entries collection
        See Also:
        RMap.readAllEntrySet()
      • entrySet

        public Set<Map.Entry<K,​V>> entrySet​(int count)
        Description copied from interface: RMap
        Returns map entries collection. Map entries are loaded in batch. Batch size is defined by count param.
        Specified by:
        entrySet in interface RMap<K,​V>
        Parameters:
        count - - size of entries batch
        Returns:
        map entries collection
        See Also:
        RMap.readAllEntrySet()
      • readAllKeySet

        public Set<K> readAllKeySet()
        Description copied from interface: RMap
        Read all keys at once
        Specified by:
        readAllKeySet in interface RMap<K,​V>
        Returns:
        keys
      • readAllValues

        public Collection<V> readAllValues()
        Description copied from interface: RMap
        Read all values at once
        Specified by:
        readAllValues in interface RMap<K,​V>
        Returns:
        values
      • readAllEntrySet

        public Set<Map.Entry<K,​V>> readAllEntrySet()
        Description copied from interface: RMap
        Read all map entries at once
        Specified by:
        readAllEntrySet in interface RMap<K,​V>
        Returns:
        entries
      • readAllMap

        public Map<K,​V> readAllMap()
        Description copied from interface: RMap
        Read all map as local instance at once
        Specified by:
        readAllMap in interface RMap<K,​V>
        Returns:
        map
      • putIfExists

        public V putIfExists​(K key,
                             V value)
        Description copied from interface: RMap
        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:
        putIfExists in interface RMap<K,​V>
        Parameters:
        key - - map key
        value - - map value
        Returns:
        null if key doesn't exist in the hash and value hasn't been set. Previous value if key already exists in the hash and new value has been stored.
      • 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>
        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.
      • putIfExistsOperationAsync

        protected RFuture<V> putIfExistsOperationAsync​(K key,
                                                       V value)
      • putIfAbsent

        public V putIfAbsent​(K key,
                             V value)
        Description copied from interface: RMap
        Stores the specified value mapped by 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:
        putIfAbsent in interface ConcurrentMap<K,​V>
        Specified by:
        putIfAbsent in interface Map<K,​V>
        Specified by:
        putIfAbsent in interface RMap<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.
      • 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>
        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.
      • hasNoWriter

        protected boolean hasNoWriter()
      • putIfAbsentOperationAsync

        protected RFuture<V> putIfAbsentOperationAsync​(K key,
                                                       V value)
      • fastPutIfAbsent

        public boolean fastPutIfAbsent​(K key,
                                       V value)
        Description copied from interface: RMap
        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 RMap.putIfAbsent(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:
        fastPutIfAbsent in interface RMap<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.
      • fastPutIfAbsentAsync

        public RFuture<Boolean> 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>
        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.
      • fastPutIfAbsentOperationAsync

        protected RFuture<Boolean> fastPutIfAbsentOperationAsync​(K key,
                                                                 V value)
      • fastPutIfExists

        public boolean fastPutIfExists​(K key,
                                       V value)
        Description copied from interface: RMap
        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 RMap.putIfExists(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:
        fastPutIfExists in interface RMap<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.
      • fastPutIfExistsAsync

        public RFuture<Boolean> 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>
        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.
      • fastPutIfExistsOperationAsync

        protected RFuture<Boolean> fastPutIfExistsOperationAsync​(K key,
                                                                 V value)
      • remove

        public boolean remove​(Object key,
                              Object value)
        Description copied from interface: RMap
        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:
        remove in interface ConcurrentMap<K,​V>
        Specified by:
        remove in interface Map<K,​V>
        Specified by:
        remove in interface RMap<K,​V>
        Parameters:
        key - - map key
        value - - map value
        Returns:
        true if map entry has been removed otherwise false.
      • removeAsync

        public RFuture<Boolean> removeAsync​(Object key,
                                            Object 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>
        Parameters:
        key - - map key
        value - - map value
        Returns:
        true if map entry has been removed otherwise false.
      • checkValue

        protected void checkValue​(Object value)
      • replace

        public boolean replace​(K key,
                               V oldValue,
                               V newValue)
        Description copied from interface: RMap
        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:
        replace in interface ConcurrentMap<K,​V>
        Specified by:
        replace in interface Map<K,​V>
        Specified by:
        replace in interface RMap<K,​V>
        Parameters:
        key - - map key
        oldValue - - map old value
        newValue - - map new value
        Returns:
        true if value has been replaced otherwise false.
      • replaceAsync

        public RFuture<Boolean> 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>
        Parameters:
        key - - map key
        oldValue - - map old value
        newValue - - map new value
        Returns:
        true if value has been replaced otherwise false.
      • replaceOperationAsync

        protected RFuture<Boolean> replaceOperationAsync​(K key,
                                                         V oldValue,
                                                         V newValue)
      • replace

        public V replace​(K key,
                         V value)
        Description copied from interface: RMap
        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:
        replace in interface ConcurrentMap<K,​V>
        Specified by:
        replace in interface Map<K,​V>
        Specified by:
        replace in interface RMap<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 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>
        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
      • replaceOperationAsync

        protected RFuture<V> replaceOperationAsync​(K key,
                                                   V value)
      • fastReplace

        public boolean fastReplace​(K key,
                                   V value)
        Description copied from interface: RMap
        Replaces previous value with a new value mapped by specified key.

        Works faster than RMap.replace(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:
        fastReplace in interface RMap<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.
      • fastReplaceAsync

        public RFuture<Boolean> 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>
        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.
      • fastReplaceOperationAsync

        protected RFuture<Boolean> fastReplaceOperationAsync​(K key,
                                                             V value)
      • getOperationAsync

        public RFuture<V> getOperationAsync​(K key)
      • getAsync

        public RFuture<V> getAsync​(K 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>
        Parameters:
        key - the key
        Returns:
        the value mapped by defined key or null if value is absent
      • loadAll

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

        public RFuture<Void> 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>
        Parameters:
        replaceExistingValues - - true if existed values should be replaced, false otherwise.
        parallelism - - parallelism level, used to increase speed of process execution
        Returns:
        void
      • loadAll

        public void loadAll​(Set<? extends K> keys,
                            boolean replaceExistingValues,
                            int parallelism)
        Description copied from interface: RMap
        Loads map entries using MapLoader whose keys are listed in defined keys parameter.
        Specified by:
        loadAll in interface RMap<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
      • loadAllAsync

        public RFuture<Void> loadAllAsync​(Set<? 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>
        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
      • loadAllAsync

        protected RFuture<Void> loadAllAsync​(Iterable<? extends K> keys,
                                             boolean replaceExistingValues,
                                             int parallelism,
                                             Map<K,​V> loadedEntires)
      • putAsync

        public RFuture<V> putAsync​(K key,
                                   V value)
        Description copied from interface: RMapAsync
        Stores the specified value mapped by specified key. Returns previous value if map entry with specified key already existed.

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

        Specified by:
        putAsync in interface RMapAsync<K,​V>
        Parameters:
        key - - map key
        value - - map value
        Returns:
        previous associated value
      • putOperationAsync

        protected RFuture<V> putOperationAsync​(K key,
                                               V value)
      • removeAsync

        public RFuture<V> removeAsync​(K key)
        Description copied from interface: RMapAsync
        Removes map entry by specified key and returns value.

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

        Specified by:
        removeAsync in interface RMapAsync<K,​V>
        Parameters:
        key - - map key
        Returns:
        deleted value, null if map entry doesn't exist
      • removeOperationAsync

        protected RFuture<V> removeOperationAsync​(K key)
      • fastPutAsync

        public RFuture<Boolean> fastPutAsync​(K key,
                                             V value)
        Description copied from interface: RMapAsync
        Stores the specified value mapped by specified key.

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

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

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

        Specified by:
        fastPutAsync in interface RMapAsync<K,​V>
        Parameters:
        key - - map key
        value - - map value
        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)
      • fastPut

        public boolean fastPut​(K key,
                               V value)
        Description copied from interface: RMap
        Stores the specified value mapped by specified key.

        Works faster than RMap.put(Object, Object) but not returning previous value.

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

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

        Specified by:
        fastPut in interface RMap<K,​V>
        Parameters:
        key - - map key
        value - - map value
        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.
      • fastRemoveAsync

        public RFuture<Long> fastRemoveAsync​(K... keys)
        Description copied from interface: RMapAsync
        Removes map entries mapped by specified keys.

        Works faster than RMapAsync.removeAsync(Object) but not returning the value.

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

        Specified by:
        fastRemoveAsync in interface RMapAsync<K,​V>
        Parameters:
        keys - - map keys
        Returns:
        the number of keys that were removed from the hash, not including specified but non existing keys
      • fastRemoveOperationBatchAsync

        protected RFuture<List<Long>> fastRemoveOperationBatchAsync​(K... keys)
      • fastRemoveOperationAsync

        protected RFuture<Long> fastRemoveOperationAsync​(K... keys)
      • fastRemove

        public long fastRemove​(K... keys)
        Description copied from interface: RMap
        Removes map entries mapped by specified keys.

        Works faster than RMap.remove(Object) but not returning the value.

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

        Specified by:
        fastRemove in interface RMap<K,​V>
        Parameters:
        keys - - map keys
        Returns:
        the number of keys that were removed from the hash, not including specified but non existing keys
      • 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>
        Parameters:
        key - - map key
        value - the value to add
        Returns:
        the updated value
      • addAndGetAsync

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

        protected RFuture<V> addAndGetOperationAsync​(K key,
                                                     Number value)
      • keyIterator

        protected Iterator<K> keyIterator​(String pattern,
                                          int count)
      • valueIterator

        protected Iterator<V> valueIterator​(String pattern,
                                            int count)
      • loadValue

        protected void loadValue​(K key,
                                 RPromise<V> result,
                                 boolean replaceValue)
      • 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
      • 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
      • 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
      • 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
      • 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.