Class CacheImpl<K,V>
java.lang.Object
io.github.resilience4j.cache.internal.CacheImpl<K,V>
- All Implemented Interfaces:
Cache<K,V>
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.github.resilience4j.cache.Cache
Cache.EventPublisher, Cache.Metrics -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncomputeIfAbsent(K cacheKey, io.github.resilience4j.core.functions.CheckedSupplier<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.Returns an EventPublisher which can be used to register event consumers.Returns the Metrics of this Cache.getName()
-
Constructor Details
-
CacheImpl
-
-
Method Details
-
getName
-
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.github.resilience4j.core.functions.CheckedSupplier<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
Description copied from interface:CacheReturns an EventPublisher which can be used to register event consumers.- Specified by:
getEventPublisherin interfaceCache<K,V> - Returns:
- an EventPublisher
-