K
- keyV
- valuepublic abstract class RedissonMultimap<K,V> extends RedissonObject implements RMultimap<K,V>
codec, commandExecutor, name
Modifier and Type | Method and Description |
---|---|
void |
clear()
Removes all key-value pairs from the multimap, leaving it empty.
|
boolean |
clearExpire()
Clear an expire timeout or expire date for object.
|
RFuture<Boolean> |
clearExpireAsync()
Clear an expire timeout or expire date for object in async mode.
|
protected RFuture<Boolean> |
clearExpireAsync(String... keys) |
boolean |
containsEntry(Object key,
Object value)
Returns
true if this multimap contains at least one key-value pair
with the key key and the value value . |
boolean |
containsKey(Object key)
Returns
true if this multimap contains at least one key-value pair
with the key key . |
boolean |
containsValue(Object value)
Returns
true if this multimap contains at least one key-value pair
with the value value . |
RFuture<Boolean> |
deleteAsync()
Delete object in async mode
|
Collection<Map.Entry<K,V>> |
entries()
Returns a view collection of all key-value pairs contained in this
multimap, as
Map.Entry instances. |
boolean |
expire(long timeToLive,
TimeUnit timeUnit)
Set a timeout for object.
|
RFuture<Boolean> |
expireAsync(long timeToLive,
TimeUnit timeUnit)
Set a timeout for object in async mode.
|
protected RFuture<Boolean> |
expireAsync(long timeToLive,
TimeUnit timeUnit,
String... keys) |
boolean |
expireAt(Date timestamp)
Set an expire date for object.
|
boolean |
expireAt(long timestamp)
Set an expire date for object.
|
RFuture<Boolean> |
expireAtAsync(Date timestamp)
Set an expire date for object in async mode.
|
RFuture<Boolean> |
expireAtAsync(long timestamp)
Set an expire date for object in async mode.
|
protected RFuture<Boolean> |
expireAtAsync(long timestamp,
String... keys) |
long |
fastRemove(K... keys)
Removes
keys from map by one operation
Works faster than RMultimap.remove but not returning
the value associated with key |
RFuture<Long> |
fastRemoveAsync(K... keys)
Removes
keys from map by one operation
Works faster than RMultimap.remove but not returning
the value associated with key |
protected <T> RFuture<T> |
fastRemoveAsync(List<Object> mapKeys,
List<Object> listKeys,
RedisCommand<T> evalCommandType) |
Collection<V> |
getAll(K key)
Returns all elements at once.
|
RCountDownLatch |
getCountDownLatch(K key)
Returns
RCountDownLatch instance associated with key |
RLock |
getFairLock(K key)
Returns
RLock instance associated with key |
RLock |
getLock(K key)
Returns
RLock instance associated with key |
RPermitExpirableSemaphore |
getPermitExpirableSemaphore(K key)
Returns
RPermitExpirableSemaphore instance associated with key |
RReadWriteLock |
getReadWriteLock(K key)
Returns
RReadWriteLock instance associated with key |
RSemaphore |
getSemaphore(K key)
Returns
RSemaphore instance associated with key |
protected String |
hash(io.netty.buffer.ByteBuf objectState) |
boolean |
isEmpty()
Check is map empty
|
protected String |
keyHash(Object key) |
Set<K> |
keySet()
Returns a view collection of all distinct keys contained in this
multimap.
|
int |
keySize()
Returns the count of distinct keys in this multimap.
|
RFuture<Integer> |
keySizeAsync()
Returns the number of key-value pairs in this multimap.
|
boolean |
put(K key,
V value)
Stores a key-value pair in this multimap.
|
boolean |
putAll(K key,
Iterable<? extends V> values)
Stores a key-value pair in this multimap for each of
values , all
using the same key, key . |
Set<K> |
readAllKeySet()
Read all keys at once
|
RFuture<Set<K>> |
readAllKeySetAsync()
Read all keys at once
|
long |
remainTimeToLive()
Remaining time to live of Redisson object that has a timeout
|
RFuture<Long> |
remainTimeToLiveAsync()
Remaining time to live of Redisson object that has a timeout
|
boolean |
remove(Object key,
Object value)
Removes a single key-value pair with the key
key and the value
value from this multimap, if such exists. |
Collection<V> |
removeAll(Object key)
Removes all values associated with the key
key . |
RFuture<Void> |
renameAsync(String newName)
Rename current object key to
newName
in async mode |
RFuture<Boolean> |
renamenxAsync(String newName)
Rename current object key to
newName
in async mode only if new key is not exists |
Collection<V> |
replaceValues(K key,
Iterable<? extends V> values)
Stores a collection of values with the same key, replacing any existing
values for that key.
|
int |
size()
Returns the number of key-value pairs in this multimap.
|
RFuture<Long> |
sizeInMemoryAsync()
Returns bytes amount used by object in Redis memory.
|
Collection<V> |
values()
Returns a view collection containing the value from each key-value
pair contained in this multimap, without collapsing duplicates (so
values().size() == size() ). |
addListener, addListener, addListenerAsync, addListenerAsync, copy, copyAsync, delete, deleteAsync, dump, dumpAsync, encode, encode, encode, encode, encodeMapKey, encodeMapKeys, encodeMapValue, encodeMapValues, get, getCodec, getIdleTime, getIdleTimeAsync, getLockByMapKey, getLockByValue, getName, getName, isExists, isExistsAsync, migrate, migrateAsync, move, moveAsync, prefixName, removeListener, removeListenerAsync, removeListenersAsync, rename, renamenx, restore, restore, restoreAndReplace, restoreAndReplace, restoreAndReplaceAsync, restoreAndReplaceAsync, restoreAsync, restoreAsync, sizeInMemory, sizeInMemoryAsync, sizeInMemoryAsync, suffixName, toSeconds, toStream, touch, touchAsync, unlink, unlinkAsync
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
clearExpire, expire, expireAt, expireAt, remainTimeToLive
addListener, copy, delete, dump, getCodec, getIdleTime, getName, isExists, migrate, move, removeListener, rename, renamenx, restore, restore, restoreAndReplace, restoreAndReplace, sizeInMemory, touch, unlink
containsEntryAsync, containsKeyAsync, containsValueAsync, getAllAsync, putAllAsync, putAsync, removeAllAsync, removeAsync, replaceValuesAsync, sizeAsync
expireAtAsync, remainTimeToLiveAsync
addListenerAsync, copyAsync, dumpAsync, getIdleTimeAsync, isExistsAsync, migrateAsync, moveAsync, removeListenerAsync, restoreAndReplaceAsync, restoreAndReplaceAsync, restoreAsync, restoreAsync, touchAsync, unlinkAsync
public RFuture<Long> sizeInMemoryAsync()
RObjectAsync
sizeInMemoryAsync
in interface RObjectAsync
sizeInMemoryAsync
in class RedissonObject
public RLock getFairLock(K key)
RMultimap
RLock
instance associated with keygetFairLock
in interface RMultimap<K,V>
key
- - map keypublic RPermitExpirableSemaphore getPermitExpirableSemaphore(K key)
RMultimap
RPermitExpirableSemaphore
instance associated with keygetPermitExpirableSemaphore
in interface RMultimap<K,V>
key
- - map keypublic RCountDownLatch getCountDownLatch(K key)
RMultimap
RCountDownLatch
instance associated with keygetCountDownLatch
in interface RMultimap<K,V>
key
- - map keypublic RSemaphore getSemaphore(K key)
RMultimap
RSemaphore
instance associated with keygetSemaphore
in interface RMultimap<K,V>
key
- - map keypublic RLock getLock(K key)
RMultimap
RLock
instance associated with keypublic RReadWriteLock getReadWriteLock(K key)
RMultimap
RReadWriteLock
instance associated with keygetReadWriteLock
in interface RMultimap<K,V>
key
- - map keyprotected String hash(io.netty.buffer.ByteBuf objectState)
public int size()
RMultimap
public int keySize()
RMultimap
public boolean isEmpty()
RMultimap
public boolean containsKey(Object key)
RMultimap
true
if this multimap contains at least one key-value pair
with the key key
.containsKey
in interface RMultimap<K,V>
key
- - map keytrue
if contains a keypublic boolean containsValue(Object value)
RMultimap
true
if this multimap contains at least one key-value pair
with the value value
.containsValue
in interface RMultimap<K,V>
value
- - map valuetrue
if contains a valuepublic boolean containsEntry(Object key, Object value)
RMultimap
true
if this multimap contains at least one key-value pair
with the key key
and the value value
.containsEntry
in interface RMultimap<K,V>
key
- - map keyvalue
- - map valuetrue
if contains an entrypublic boolean put(K key, V value)
RMultimap
Some multimap implementations allow duplicate key-value pairs, in which
case put
always adds a new key-value pair and increases the
multimap size by 1. Other implementations prohibit duplicates, and storing
a key-value pair that's already in the multimap has no effect.
public boolean remove(Object key, Object value)
RMultimap
key
and the value
value
from this multimap, if such exists. If multiple key-value
pairs in the multimap fit this description, which one is removed is
unspecified.public boolean putAll(K key, Iterable<? extends V> values)
RMultimap
values
, all
using the same key, key
. Equivalent to (but expected to be more
efficient than):
for (V value : values) {
put(key, value);
}
In particular, this is a no-op if values
is empty.
public void clear()
RMultimap
public Set<K> keySet()
RMultimap
Changes to the returned set will update the underlying multimap, and vice versa. However, adding to the returned set is not possible.
public Collection<V> values()
RMultimap
values().size() == size()
).
Changes to the returned collection will update the underlying multimap, and vice versa. However, adding to the returned collection is not possible.
public Collection<V> getAll(K key)
RMultimap
public Collection<V> removeAll(Object key)
RMultimap
key
.
Once this method returns, key
will not be mapped to any values
Use RMultimap.fastRemove(K...)
if values are not needed.
public Collection<V> replaceValues(K key, Iterable<? extends V> values)
RMultimap
If values
is empty, this is equivalent to
removeAll(key)
.
replaceValues
in interface RMultimap<K,V>
key
- - map keyvalues
- - map valuespublic Collection<Map.Entry<K,V>> entries()
RMultimap
Map.Entry
instances.
Changes to the returned collection or the entries it contains will update the underlying multimap, and vice versa. However, adding to the returned collection is not possible.
public Set<K> readAllKeySet()
RMultimap
readAllKeySet
in interface RMultimap<K,V>
public RFuture<Set<K>> readAllKeySetAsync()
RMultimapAsync
readAllKeySetAsync
in interface RMultimapAsync<K,V>
public long fastRemove(K... keys)
RMultimap
keys
from map by one operation
Works faster than RMultimap.remove
but not returning
the value associated with key
fastRemove
in interface RMultimap<K,V>
keys
- - map keyspublic RFuture<Long> fastRemoveAsync(K... keys)
RMultimapAsync
keys
from map by one operation
Works faster than RMultimap.remove
but not returning
the value associated with key
fastRemoveAsync
in interface RMultimapAsync<K,V>
keys
- - map keysprotected <T> RFuture<T> fastRemoveAsync(List<Object> mapKeys, List<Object> listKeys, RedisCommand<T> evalCommandType)
public RFuture<Boolean> deleteAsync()
RObjectAsync
deleteAsync
in interface RObjectAsync
deleteAsync
in class RedissonObject
true
if object was deleted false
if notpublic RFuture<Void> renameAsync(String newName)
RObjectAsync
newName
in async moderenameAsync
in interface RObjectAsync
renameAsync
in class RedissonObject
newName
- - new name of objectpublic RFuture<Boolean> renamenxAsync(String newName)
RObjectAsync
newName
in async mode only if new key is not existsrenamenxAsync
in interface RObjectAsync
renamenxAsync
in class RedissonObject
newName
- - new name of objecttrue
if object has been renamed successfully and false
otherwisepublic RFuture<Boolean> expireAsync(long timeToLive, TimeUnit timeUnit)
RExpirableAsync
expireAsync
in interface RExpirableAsync
timeToLive
- - timeout before object will be deletedtimeUnit
- - timeout time unittrue
if the timeout was set and false
if notpublic RFuture<Boolean> expireAtAsync(long timestamp)
RExpirableAsync
expireAtAsync
in interface RExpirableAsync
timestamp
- - expire date in milliseconds (Unix timestamp)true
if the timeout was set and false
if notpublic RFuture<Boolean> clearExpireAsync()
RExpirableAsync
clearExpireAsync
in interface RExpirableAsync
true
if the timeout was cleared and false
if notpublic RFuture<Integer> keySizeAsync()
RMultimapAsync
keySizeAsync
in interface RMultimapAsync<K,V>
public boolean expire(long timeToLive, TimeUnit timeUnit)
RExpirable
expire
in interface RExpirable
timeToLive
- - timeout before object will be deletedtimeUnit
- - timeout time unittrue
if the timeout was set and false
if notpublic boolean expireAt(long timestamp)
RExpirable
expireAt
in interface RExpirable
timestamp
- - expire date in milliseconds (Unix timestamp)true
if the timeout was set and false
if notpublic boolean expireAt(Date timestamp)
RExpirable
expireAt
in interface RExpirable
timestamp
- - expire datetrue
if the timeout was set and false
if notpublic RFuture<Boolean> expireAtAsync(Date timestamp)
RExpirableAsync
expireAtAsync
in interface RExpirableAsync
timestamp
- - expire datetrue
if the timeout was set and false
if notpublic boolean clearExpire()
RExpirable
clearExpire
in interface RExpirable
true
if timeout was removed
false
if object does not exist or does not have an associated timeoutpublic long remainTimeToLive()
RExpirable
remainTimeToLive
in interface RExpirable
public RFuture<Long> remainTimeToLiveAsync()
RExpirableAsync
remainTimeToLiveAsync
in interface RExpirableAsync
protected RFuture<Boolean> expireAsync(long timeToLive, TimeUnit timeUnit, String... keys)
Copyright © 2014–2020 Redisson. All rights reserved.