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 V
computeIfAbsent(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.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()
-
-
-
Method Detail
-
getName
public java.lang.String getName()
-
getMetrics
public Cache.Metrics getMetrics()
Description copied from interface:Cache
Returns the Metrics of this Cache.- Specified by:
getMetrics
in interfaceCache<K,V>
- Returns:
- the Metrics of this Cache
-
computeIfAbsent
public V computeIfAbsent(K cacheKey, io.vavr.CheckedFunction0<V> supplier)
Description copied from interface:Cache
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. Otherwise it returns the cached value. If the function itself throws an (unchecked) exception, the exception is rethrown.- Specified by:
computeIfAbsent
in 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:Cache
Returns an EventPublisher which can be used to register event consumers.- Specified by:
getEventPublisher
in interfaceCache<K,V>
- Returns:
- an EventPublisher
-
-