K
- map keyV
- valuepublic interface RMap<K,V> extends ConcurrentMap<K,V>, RExpirable, RMapAsync<K,V>
ConcurrentMap
and Map
This map doesn't allow to store null
as key or value.Modifier and Type | Method and Description |
---|---|
V |
addAndGet(K key,
Number delta)
Atomically adds the given
delta to the current value
by mapped key . |
Set<Map.Entry<K,V>> |
entrySet()
Returns map entries collection.
|
Set<Map.Entry<K,V>> |
entrySet(String keyPattern)
Returns map entries collection matches key pattern.
|
boolean |
fastPut(K key,
V value)
Associates the specified
value with the specified key . |
boolean |
fastPutIfAbsent(K key,
V value)
Associates the specified
value with the specified key
only if there is no any association with specifiedkey . |
long |
fastRemove(K... keys)
Removes
keys from map by one operation
Works faster than but not returning
the value associated with key
If MapWriter is defined then keys are deleted in write-through mode. |
boolean |
fastReplace(K key,
V value)
Replaces previous value with a new
value associated with the key . |
V |
get(Object key)
Returns the value to which the specified key is mapped,
or
null if this map contains no mapping for the key. |
Map<K,V> |
getAll(Set<K> keys)
Gets a map slice contained the mappings with defined
keys
by one operation. |
RLock |
getLock(K key)
Returns
RLock instance associated with key |
RReadWriteLock |
getReadWriteLock(K key)
Returns
RReadWriteLock instance associated with key |
Set<K> |
keySet()
Returns key set.
|
Set<K> |
keySet(String pattern)
Returns key set matches pattern.
|
void |
loadAll(boolean replaceExistingValues,
int parallelism)
Loads all map entries to this Redis map using
MapLoader . |
void |
loadAll(Set<? extends K> keys,
boolean replaceExistingValues,
int parallelism)
Loads map entries using
MapLoader whose keys are listed in defined keys parameter. |
<KOut,VOut> |
mapReduce()
Returns
RMapReduce object associated with this map |
V |
put(K key,
V value)
Associates the specified
value with the specified key
in async manner. |
void |
putAll(Map<? extends K,? extends V> map)
Associates the specified
value with the specified key
in batch. |
V |
putIfAbsent(K key,
V value)
Associates the specified
value with the specified key
only if there is no any association with specifiedkey . |
Set<Map.Entry<K,V>> |
readAllEntrySet()
Read all map entries at once
|
Set<K> |
readAllKeySet()
Read all keys at once
|
Map<K,V> |
readAllMap()
Read all map as local instance at once
|
Collection<V> |
readAllValues()
Read all values at once
|
V |
remove(Object key)
Removes
key from map and returns associated value in async manner. |
boolean |
remove(Object key,
Object value)
Removes
key from map only if it associated with value . |
V |
replace(K key,
V value)
Replaces previous value with a new
value associated with the key . |
boolean |
replace(K key,
V oldValue,
V newValue)
Replaces previous
oldValue with a newValue associated with the key . |
Collection<V> |
values()
Returns values collection.
|
Collection<V> |
values(String keyPattern)
Returns values collection matches key pattern.
|
int |
valueSize(K key)
Returns size of value mapped by key in bytes
|
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, replaceAll
clear, containsKey, containsValue, equals, hashCode, isEmpty, size
clearExpire, expire, expireAt, expireAt, remainTimeToLive
copy, delete, getCodec, getName, isExists, migrate, move, rename, renamenx, touch, unlink
addAndGetAsync, containsKeyAsync, containsValueAsync, fastPutAsync, fastPutIfAbsentAsync, fastRemoveAsync, fastReplaceAsync, getAllAsync, getAsync, loadAllAsync, loadAllAsync, putAllAsync, putAsync, putIfAbsentAsync, readAllEntrySetAsync, readAllKeySetAsync, readAllMapAsync, readAllValuesAsync, removeAsync, removeAsync, replaceAsync, replaceAsync, sizeAsync, valueSizeAsync
clearExpireAsync, expireAsync, expireAtAsync, expireAtAsync, remainTimeToLiveAsync
copyAsync, deleteAsync, isExistsAsync, migrateAsync, moveAsync, renameAsync, renamenxAsync, touchAsync, unlinkAsync
void loadAll(boolean replaceExistingValues, int parallelism)
MapLoader
.replaceExistingValues
- - true
if existed values should be replaced, false
otherwise.parallelism
- - parallelism level, used to increase speed of process executionvoid loadAll(Set<? extends K> keys, boolean replaceExistingValues, int parallelism)
MapLoader
whose keys are listed in defined keys
parameter.keys
- - map keysreplaceExistingValues
- - true
if existed values should be replaced, false
otherwise.parallelism
- - parallelism level, used to increase speed of process executionV get(Object key)
null
if this map contains no mapping for the key.
If map doesn't contain value for specified key and MapLoader
is defined
then value will be loaded in read-through mode.
V put(K key, V value)
value
with the specified key
in async manner.
If MapWriter
is defined then new map entry is stored in write-through mode.
V putIfAbsent(K key, V value)
value
with the specified key
only if there is no any association with specifiedkey
.
If MapWriter
is defined then new map entry is stored in write-through mode.
putIfAbsent
in interface ConcurrentMap<K,V>
putIfAbsent
in interface Map<K,V>
key
- - map keyvalue
- - map valuenull
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.<KOut,VOut> RMapReduce<K,V,KOut,VOut> mapReduce()
RMapReduce
object associated with this mapKOut
- output keyVOut
- output valueRReadWriteLock getReadWriteLock(K key)
RReadWriteLock
instance associated with keykey
- - map keyRLock getLock(K key)
RLock
instance associated with keykey
- - map keyint valueSize(K key)
key
- - map keyV addAndGet(K key, Number delta)
delta
to the current value
by mapped key
.
Works only for numeric values!key
- - map keydelta
- the value to addV remove(Object key)
key
from map and returns associated value in async manner.
If MapWriter
is defined then key
is deleted in write-through mode.
V replace(K key, V value)
value
associated with the key
.
If there wasn't any association before then method returns null
.
If MapWriter
is defined then new value
is written in write-through mode.
boolean replace(K key, V oldValue, V newValue)
oldValue
with a newValue
associated with the key
.
If previous value doesn't exist or equal to oldValue
then method returns false
.
If MapWriter
is defined then newValue
is written in write-through mode.
boolean remove(Object key, Object value)
key
from map only if it associated with value
.
If MapWriter
is defined then key
is deleted in write-through mode.
void putAll(Map<? extends K,? extends V> map)
value
with the specified key
in batch.
If MapWriter
is defined then new map entries will be stored in write-through mode.
Map<K,V> getAll(Set<K> keys)
keys
by one operation.
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.
keys
- - map keyslong fastRemove(K... keys)
keys
from map by one operation
Works faster than
but not returning
the value associated with remove(Object)
key
If MapWriter
is defined then keys
are deleted in write-through mode.
keys
- - map keysboolean fastPut(K key, V value)
value
with the specified key
.
Works faster than
but not returning
the previous value associated with put(Object, Object)
key
If MapWriter
is defined then new map entry is stored in write-through mode.
key
- - map keyvalue
- - map valuetrue
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.boolean fastReplace(K key, V value)
value
associated with the key
.
Works faster than
but not returning
the previous value associated with replace(Object, Object)
key
If MapWriter
is defined then new map entry is stored in write-through mode.
key
- - map keyvalue
- - map valuetrue
if key exists and value was updated.
false
if key doesn't exists and value wasn't updated.boolean fastPutIfAbsent(K key, V value)
value
with the specified key
only if there is no any association with specifiedkey
.
Works faster than
but not returning
the previous value associated with putIfAbsent(Object, Object)
key
If MapWriter
is defined then new map entry is stored in write-through mode.
key
- - map keyvalue
- - map valuetrue
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.Collection<V> readAllValues()
Set<K> keySet()
readAllKeySet()
does.Set<K> keySet(String pattern)
readAllKeySet()
does.
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
pattern
- - key patternCollection<V> values()
readAllValues()
does.Collection<V> values(String keyPattern)
readAllValues()
does.
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
keyPattern
- - key patternSet<Map.Entry<K,V>> entrySet()
readAllEntrySet()
does.Set<Map.Entry<K,V>> entrySet(String keyPattern)
readAllEntrySet()
does.
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
keyPattern
- - key patternCopyright © 2014–2018 The Redisson Project. All rights reserved.