K
- the type parameterV
- the type parameter@FunctionalInterface
public interface DistributedCacheManager<K extends java.io.Serializable,V extends DistributedCacheObject>
extends java.io.Closeable
DistributedCacheManager
that acts as a facade for a cache implementation.
It's designed via generics to accept a key, a value associated with that key and an output object.
While mostly value and output are one of the same, these are made separate intentionally
to avoid serialization issues and provide flexibility to provide transformations on the final result.Modifier and Type | Method and Description |
---|---|
default boolean |
contains(K key)
Contains key in the cache?
|
default java.util.Optional<V> |
find(java.util.function.Predicate<V> filter)
Find values matching this predicate.
|
default java.util.Collection<V> |
findAll(java.util.function.Predicate<V> filter)
Find values matching this predicate.
|
default V |
get(K key)
Get item.
|
default java.util.Collection<V> |
getAll()
Gets all items in the cache.
|
default java.lang.String |
getName()
Gets the cache impl name.
|
default void |
remove(K key,
V item)
Remove key/item from the cache.
|
default void |
set(K key,
V item)
Set item in the cache.
|
default void |
update(K key,
V item)
update key/item from the cache and overwrite.
|
default V get(K key)
key
- the keydefault java.util.Collection<V> getAll()
default void set(K key, V item)
key
- the keyitem
- the item to store in the cachedefault boolean contains(K key)
key
- the keydefault void update(K key, V item)
key
- the keyitem
- the itemdefault void remove(K key, V item)
key
- the keyitem
- the itemdefault java.lang.String getName()
default java.util.Collection<V> findAll(java.util.function.Predicate<V> filter)
filter
- the filter