Package io.lettuce.core.support.caching
Interface RedisCache<K,V>
-
- Type Parameters:
K
- Key type.V
- Value type.
public interface RedisCache<K,V>
Interface defining common Redis Cache operations.- Since:
- 6.0
- Author:
- Mark Paluch
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
addInvalidationListener(Consumer<? super K> listener)
Register a invalidationlistener
that is notified if a key in this Redis cache expires or gets modified.void
close()
Closes this Redis cache and releases any connections associated with it.V
get(K key)
Retrieve avalue
from Redis for the given cachekey
.void
put(K key, V value)
Associate the specified value with the specified key in this Redis cache.
-
-
-
Method Detail
-
get
V get(K key)
Retrieve avalue
from Redis for the given cachekey
.- Parameters:
key
- the key whose associated value is to be returned.- Returns:
- the value to which this Redis cache value maps the specified key (which may be
null
itself), or alsonull
if the Redis cache contains no mapping for this key.
-
put
void put(K key, V value)
Associate the specified value with the specified key in this Redis cache.- Parameters:
key
- the key with which the specified value is to be associated.value
- the value to be associated with the specified key.
-
addInvalidationListener
void addInvalidationListener(Consumer<? super K> listener)
Register a invalidationlistener
that is notified if a key in this Redis cache expires or gets modified.- Parameters:
listener
- the listener to notify.
-
close
void close()
Closes this Redis cache and releases any connections associated with it. If the cache is already closed then invoking this method has no effect.
-
-