Class CacheImpl<K,V>
- java.lang.Object
-
- io.github.resilience4j.cache.internal.CacheImpl<K,V>
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface io.github.resilience4j.cache.Cache
Cache.EventPublisher, Cache.Metrics
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description VcomputeIfAbsent(K cacheKey, 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.Cache.EventPublishergetEventPublisher()Returns an EventPublisher which can be used to register event consumers.Cache.MetricsgetMetrics()Returns the Metrics of this Cache.java.lang.StringgetName()
-
-
-
Method Detail
-
getName
public java.lang.String getName()
-
getMetrics
public Cache.Metrics getMetrics()
Description copied from interface:CacheReturns the Metrics of this Cache.- Specified by:
getMetricsin interfaceCache<K,V>- Returns:
- the Metrics of this Cache
-
computeIfAbsent
public V computeIfAbsent(K cacheKey, io.vavr.CheckedFunction0<V> supplier)
Description copied from interface:CacheIf 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. Otherwise it returns the cached value. If the function itself throws an (unchecked) exception, the exception is rethrown.- Specified by:
computeIfAbsentin interfaceCache<K,V>- Parameters:
cacheKey- key with which the specified value is to be associatedsupplier- value to be associated with the specified key- Returns:
- cached value
-
getEventPublisher
public Cache.EventPublisher getEventPublisher()
Description copied from interface:CacheReturns an EventPublisher which can be used to register event consumers.- Specified by:
getEventPublisherin interfaceCache<K,V>- Returns:
- an EventPublisher
-
-