Interface RMap<K,V>

    • Method Detail

      • loadAll

        void loadAll(boolean replaceExistingValues,
                     int parallelism)
        Loads all map entries to this Redis map using MapLoader.
        Parameters:
        replaceExistingValues - - true if existed values should be replaced, false otherwise.
        parallelism - - parallelism level, used to increase speed of process execution
      • loadAll

        void loadAll(Set<? extends K> keys,
                     boolean replaceExistingValues,
                     int parallelism)
        Loads map entries using MapLoader whose keys are listed in defined keys parameter.
        Parameters:
        keys - - map keys
        replaceExistingValues - - true if existed values should be replaced, false otherwise.
        parallelism - - parallelism level, used to increase speed of process execution
      • get

        V get(Object key)
        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>
        Parameters:
        key - the key
        Returns:
        the value mapped by defined key or null if value is absent
      • put

        V put(K key,
              V value)
        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>
        Parameters:
        key - - map key
        value - - map value
        Returns:
        previous associated value
      • putIfAbsent

        V putIfAbsent(K key,
                      V value)
        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>
        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.
      • putIfExists

        V putIfExists(K key,
                      V value)
        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.

        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.
      • randomKeys

        Set<K> randomKeys(int count)
        Returns random keys from this map limited by count
        Parameters:
        count - - keys amount to return
        Returns:
        random keys
      • randomEntries

        Map<K,V> randomEntries(int count)
        Returns random map entries from this map limited by count
        Parameters:
        count - - entries amount to return
        Returns:
        random entries
      • mapReduce

        <KOut,VOut> RMapReduce<K,V,KOut,VOut> mapReduce()
        Returns RMapReduce object associated with this map
        Type Parameters:
        KOut - output key
        VOut - output value
        Returns:
        MapReduce instance
      • getCountDownLatch

        RCountDownLatch getCountDownLatch(K key)
        Returns RCountDownLatch instance associated with key
        Parameters:
        key - - map key
        Returns:
        countdownlatch
      • getPermitExpirableSemaphore

        RPermitExpirableSemaphore getPermitExpirableSemaphore(K key)
        Returns RPermitExpirableSemaphore instance associated with key
        Parameters:
        key - - map key
        Returns:
        permitExpirableSemaphore
      • getSemaphore

        RSemaphore getSemaphore(K key)
        Returns RSemaphore instance associated with key
        Parameters:
        key - - map key
        Returns:
        semaphore
      • getFairLock

        RLock getFairLock(K key)
        Returns RLock instance associated with key
        Parameters:
        key - - map key
        Returns:
        fairlock
      • getReadWriteLock

        RReadWriteLock getReadWriteLock(K key)
        Returns RReadWriteLock instance associated with key
        Parameters:
        key - - map key
        Returns:
        readWriteLock
      • getLock

        RLock getLock(K key)
        Returns RLock instance associated with key
        Parameters:
        key - - map key
        Returns:
        lock
      • valueSize

        int valueSize(K key)
        Returns size of value mapped by specified key in bytes
        Parameters:
        key - - map key
        Returns:
        size of value
      • addAndGet

        V addAndGet(K key,
                    Number delta)
        Adds the given delta to the current value by mapped key. Works only for numeric values!
        Parameters:
        key - - map key
        delta - the value to add
        Returns:
        the updated value
      • containsKey

        boolean containsKey(Object key)
        Returns true if this map contains map entry mapped by specified key, otherwise false
        Specified by:
        containsKey in interface Map<K,V>
        Parameters:
        key - - map key
        Returns:
        true if this map contains map entry mapped by specified key, otherwise false
      • containsValue

        boolean containsValue(Object value)
        Returns true if this map contains any map entry with specified value, otherwise false
        Specified by:
        containsValue in interface Map<K,V>
        Parameters:
        value - - map value
        Returns:
        true if this map contains any map entry with specified value, otherwise false
      • remove

        V remove(Object key)
        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>
        Parameters:
        key - - map key
        Returns:
        deleted value, null if map entry doesn't exist
      • replace

        V replace(K key,
                  V value)
        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>
        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
      • replace

        boolean replace(K key,
                        V oldValue,
                        V newValue)
        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>
        Parameters:
        key - - map key
        oldValue - - map old value
        newValue - - map new value
        Returns:
        true if value has been replaced otherwise false.
      • remove

        boolean remove(Object key,
                       Object value)
        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>
        Parameters:
        key - - map key
        value - - map value
        Returns:
        true if map entry has been removed otherwise false.
      • putAll

        void putAll(Map<? extends K,? extends V> map)
        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>
        Parameters:
        map - mappings to be stored in this map
      • putAll

        void putAll(Map<? extends K,? extends V> map,
                    int batchSize)
        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.

        Parameters:
        map - mappings to be stored in this map
        batchSize - - size of map entries batch
      • getAll

        Map<K,V> getAll(Set<K> keys)
        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.

        Parameters:
        keys - - map keys
        Returns:
        Map slice
      • fastRemove

        long fastRemove(K... keys)
        Removes map entries mapped by specified keys.

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

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

        Parameters:
        keys - - map keys
        Returns:
        the number of keys that were removed from the hash, not including specified but non existing keys
      • fastPut

        boolean fastPut(K key,
                        V value)
        Stores the specified value mapped by specified key.

        Works faster than 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.

        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.
      • fastReplace

        boolean fastReplace(K key,
                            V value)
        Replaces previous value with a new value mapped by specified key.

        Works faster than 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.

        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.
      • fastPutIfAbsent

        boolean fastPutIfAbsent(K key,
                                V value)
        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 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.

        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.
      • fastPutIfExists

        boolean fastPutIfExists(K key,
                                V value)
        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 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.

        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.
      • readAllKeySet

        Set<K> readAllKeySet()
        Read all keys at once
        Returns:
        keys
      • readAllValues

        Collection<V> readAllValues()
        Read all values at once
        Returns:
        values
      • readAllEntrySet

        Set<Map.Entry<K,V>> readAllEntrySet()
        Read all map entries at once
        Returns:
        entries
      • readAllMap

        Map<K,V> readAllMap()
        Read all map as local instance at once
        Returns:
        map
      • keySet

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

        Set<K> keySet(int count)
        Returns key set of this map. Keys are loaded in batch. Batch size is defined by count param.
        Parameters:
        count - - size of keys batch
        Returns:
        key set
        See Also:
        readAllKeySet()
      • keySet

        Set<K> keySet(String pattern,
                      int count)
        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

        Parameters:
        pattern - - key pattern
        count - - size of keys batch
        Returns:
        key set
        See Also:
        readAllKeySet()
      • keySet

        Set<K> keySet(String pattern)
        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

        Parameters:
        pattern - - key pattern
        Returns:
        key set
        See Also:
        readAllKeySet()
      • values

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

        Collection<V> values(String keyPattern)
        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

        Parameters:
        keyPattern - - key pattern
        Returns:
        values collection
        See Also:
        readAllValues()
      • values

        Collection<V> values(String keyPattern,
                             int count)
        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

        Parameters:
        keyPattern - - key pattern
        count - - size of values batch
        Returns:
        values collection
        See Also:
        readAllValues()
      • values

        Collection<V> values(int count)
        Returns values collection of this map. Values are loaded in batch. Batch size is defined by count param.
        Parameters:
        count - - size of values batch
        Returns:
        values collection
        See Also:
        readAllValues()
      • entrySet

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

        Set<Map.Entry<K,V>> entrySet(String keyPattern)
        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

        Parameters:
        keyPattern - - key pattern
        Returns:
        map entries collection
        See Also:
        readAllEntrySet()
      • entrySet

        Set<Map.Entry<K,V>> entrySet(String keyPattern,
                                           int count)
        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

        Parameters:
        keyPattern - - key pattern
        count - - size of entries batch
        Returns:
        map entries collection
        See Also:
        readAllEntrySet()
      • entrySet

        Set<Map.Entry<K,V>> entrySet(int count)
        Returns map entries collection. Map entries are loaded in batch. Batch size is defined by count param.
        Parameters:
        count - - size of entries batch
        Returns:
        map entries collection
        See Also:
        readAllEntrySet()