public class DefaultRedisMap<K,V> extends Object implements RedisMap<K,V>
RedisMap. Note that the current implementation doesn't provide the same locking
semantics across all methods. In highly concurrent environments, race conditions might appear.| Constructor and Description |
|---|
DefaultRedisMap(BoundHashOperations<String,K,V> boundOps)
Constructs a new
DefaultRedisMap instance. |
DefaultRedisMap(String key,
RedisOperations<String,?> operations)
Constructs a new
DefaultRedisMap instance. |
| Modifier and Type | Method and Description |
|---|---|
void |
clear() |
boolean |
containsKey(Object key) |
boolean |
containsValue(Object value) |
Set<Map.Entry<K,V>> |
entrySet() |
boolean |
equals(Object o) |
Boolean |
expire(long timeout,
TimeUnit unit)
Sets the key time-to-live/expiration.
|
Boolean |
expireAt(Date date)
Sets the key time-to-live/expiration.
|
V |
get(Object key) |
Long |
getExpire()
Returns the expiration of this key.
|
String |
getKey()
Returns the key associated with this entity.
|
RedisOperations<String,?> |
getOperations()
Returns the underlying Redis operations used by the backing implementation.
|
DataType |
getType()
Returns the associated Redis type.
|
int |
hashCode() |
Double |
increment(K key,
double delta)
Increment
value of the hash key by the given delta. |
Long |
increment(K key,
long delta)
Increment
value of the hash key by the given delta. |
boolean |
isEmpty() |
Set<K> |
keySet() |
Boolean |
persist()
Removes the expiration (if any) of the key.
|
V |
put(K key,
V value) |
void |
putAll(Map<? extends K,? extends V> m) |
V |
putIfAbsent(K key,
V value) |
Map.Entry<K,V> |
randomEntry()
Get a random entry from the hash.
|
K |
randomKey()
Get a random key from the hash.
|
V |
remove(Object key) |
boolean |
remove(Object key,
Object value) |
void |
rename(String newKey)
Renames the key.
|
V |
replace(K key,
V value) |
boolean |
replace(K key,
V oldValue,
V newValue) |
Cursor<Map.Entry<K,V>> |
scan() |
int |
size() |
String |
toString() |
Collection<V> |
values() |
clone, finalize, getClass, notify, notifyAll, wait, wait, waitexpire, expireAtcompute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, replaceAllpublic DefaultRedisMap(String key, RedisOperations<String,?> operations)
DefaultRedisMap instance.key - Redis key of this map.operations - RedisOperations for this map.RedisOperations.getHashKeySerializer(),
RedisOperations.getValueSerializer()public DefaultRedisMap(BoundHashOperations<String,K,V> boundOps)
DefaultRedisMap instance.boundOps - BoundHashOperations for this map.public Long increment(K key, long delta)
RedisMapvalue of the hash key by the given delta.public Double increment(K key, double delta)
RedisMapvalue of the hash key by the given delta.public K randomKey()
RedisMappublic Map.Entry<K,V> randomEntry()
RedisMaprandomEntry in interface RedisMap<K,V>public RedisOperations<String,?> getOperations()
RedisStoregetOperations in interface RedisStorepublic boolean containsKey(Object key)
containsKey in interface Map<K,V>public boolean containsValue(Object value)
containsValue in interface Map<K,V>public int hashCode()
@Nullable public V putIfAbsent(K key, V value)
putIfAbsent in interface ConcurrentMap<K,V>putIfAbsent in interface Map<K,V>public Boolean expire(long timeout, TimeUnit unit)
BoundKeyOperationsexpire in interface BoundKeyOperations<String>timeout - expiration valueunit - expiration unitpublic Boolean expireAt(Date date)
BoundKeyOperationsexpireAt in interface BoundKeyOperations<String>date - expiration datepublic Long getExpire()
BoundKeyOperationsgetExpire in interface BoundKeyOperations<String>public Boolean persist()
BoundKeyOperationspersist in interface BoundKeyOperations<String>public String getKey()
BoundKeyOperationsgetKey in interface BoundKeyOperations<String>public void rename(String newKey)
BoundKeyOperationsrename in interface BoundKeyOperations<String>newKey - new key. Must not be null.public DataType getType()
BoundKeyOperationsgetType in interface BoundKeyOperations<String>Copyright © 2011–2023 Pivotal Software, Inc.. All rights reserved.