public interface Cache<K,V>
| Modifier and Type | Interface and Description |
|---|---|
static interface |
Cache.EventPublisher
An EventPublisher which can be used to register event consumers.
|
static interface |
Cache.Metrics |
| Modifier and Type | Method and Description |
|---|---|
V |
computeIfAbsent(K key,
io.vavr.CheckedFunction0<V> supplier)
If the key is not already associated with a cached value, attempts to compute its value using the
given supplier and puts it into the cache.
|
static <K,R> io.vavr.CheckedFunction1<K,R> |
decorateCallable(Cache<K,R> cache,
java.util.concurrent.Callable<R> callable)
Creates a functions which returns a value from a cache, if it exists.
|
static <K,R> io.vavr.CheckedFunction1<K,R> |
decorateCheckedSupplier(Cache<K,R> cache,
io.vavr.CheckedFunction0<R> supplier)
Creates a functions which returns a value from a cache, if it exists.
|
static <K,R> java.util.function.Function<K,R> |
decorateSupplier(Cache<K,R> cache,
java.util.function.Supplier<R> supplier)
Creates a functions which returns a value from a cache, if it exists.
|
Cache.EventPublisher |
getEventPublisher()
Returns an EventPublisher which can be used to register event consumers.
|
Cache.Metrics |
getMetrics()
Returns the Metrics of this Cache.
|
java.lang.String |
getName() |
static <K,V> Cache<K,V> |
of(javax.cache.Cache<K,V> cache)
Creates a Retry with default configuration.
|
java.lang.String getName()
Cache.Metrics getMetrics()
V computeIfAbsent(K key, io.vavr.CheckedFunction0<V> supplier)
key - key with which the specified value is to be associatedsupplier - value to be associated with the specified keyCache.EventPublisher getEventPublisher()
static <K,V> Cache<K,V> of(javax.cache.Cache<K,V> cache)
K - the type of keyV - the type of valuecache - the wrapped JCache instancestatic <K,R> io.vavr.CheckedFunction1<K,R> decorateCheckedSupplier(Cache<K,R> cache, io.vavr.CheckedFunction0<R> supplier)
K - the type of keyR - the type of valuecache - the Cachesupplier - the original Supplierstatic <K,R> java.util.function.Function<K,R> decorateSupplier(Cache<K,R> cache, java.util.function.Supplier<R> supplier)
K - the type of keyR - the type of valuecache - the Cachesupplier - the original Supplierstatic <K,R> io.vavr.CheckedFunction1<K,R> decorateCallable(Cache<K,R> cache, java.util.concurrent.Callable<R> callable)
K - the type of keyR - the type of valuecache - the Cachecallable - the original Callable