Class CaffeineCache
- java.lang.Object
-
- io.quarkus.cache.runtime.AbstractCache
-
- io.quarkus.cache.runtime.caffeine.CaffeineCache
-
- All Implemented Interfaces:
Cache
public class CaffeineCache extends AbstractCache
This class is an internal Quarkus cache implementation. Do not use it explicitly from your Quarkus application. The public methods signatures may change without prior notice.
-
-
Field Summary
-
Fields inherited from class io.quarkus.cache.runtime.AbstractCache
NULL_KEYS_NOT_SUPPORTED_MSG
-
-
Constructor Summary
Constructors Constructor Description CaffeineCache(CaffeineCacheInfo cacheInfo)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CompletableFuture<Object>get(Object key, Function<Object,Object> valueLoader)Returns aCompletableFutureholding the cache value identified bykey, obtaining that value fromvalueLoaderif necessary.DurationgetExpireAfterAccess()DurationgetExpireAfterWrite()IntegergetInitialCapacity()LonggetMaximumSize()StringgetName()longgetSize()voidinvalidate(Object key)voidinvalidateAll()io.smallrye.mutiny.Uni<Void>replaceUniValue(Object key, Object emittedValue)Replaces the cache value associated with the given key by an item emitted by aUni.-
Methods inherited from class io.quarkus.cache.runtime.AbstractCache
getDefaultKey
-
-
-
-
Constructor Detail
-
CaffeineCache
public CaffeineCache(CaffeineCacheInfo cacheInfo)
-
-
Method Detail
-
getName
public String getName()
- Specified by:
getNamein classAbstractCache
-
get
public CompletableFuture<Object> get(Object key, Function<Object,Object> valueLoader)
Returns aCompletableFutureholding the cache value identified bykey, obtaining that value fromvalueLoaderif necessary. The value computation is done synchronously on the calling thread and theCompletableFutureis immediately completed before being returned.- Specified by:
getin classAbstractCache- Parameters:
key- cache keyvalueLoader- function used to compute the cache value ifkeyis not already associated with a value- Returns:
- a
CompletableFutureholding the cache value - Throws:
CacheException- if an exception is thrown during the cache value computation
-
invalidate
public void invalidate(Object key)
- Specified by:
invalidatein classAbstractCache
-
invalidateAll
public void invalidateAll()
- Specified by:
invalidateAllin classAbstractCache
-
replaceUniValue
public io.smallrye.mutiny.Uni<Void> replaceUniValue(Object key, Object emittedValue)
Description copied from class:AbstractCacheReplaces the cache value associated with the given key by an item emitted by aUni. This method can be called several times for the same key, each call will then always replace the existing cache entry with the given emitted value. If the key no longer identifies a cache entry, this method must not put the emitted item into the cache.- Specified by:
replaceUniValuein classAbstractCache
-
getInitialCapacity
public Integer getInitialCapacity()
-
getMaximumSize
public Long getMaximumSize()
-
getExpireAfterWrite
public Duration getExpireAfterWrite()
-
getExpireAfterAccess
public Duration getExpireAfterAccess()
-
getSize
public long getSize()
-
-