Class CaffeineCacheImpl

  • All Implemented Interfaces:
    Cache, CaffeineCache

    public class CaffeineCacheImpl
    extends AbstractCache
    implements CaffeineCache
    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 Detail

      • cache

        final com.github.benmanes.caffeine.cache.AsyncCache<Object,​Object> cache
    • Constructor Detail

      • CaffeineCacheImpl

        public CaffeineCacheImpl​(CaffeineCacheInfo cacheInfo,
                                 boolean recordStats)
    • Method Detail

      • getName

        public String getName()
        Description copied from interface: Cache
        Returns the cache name.
        Specified by:
        getName in interface Cache
        Returns:
        cache name
      • get

        public <K,​V> io.smallrye.mutiny.Uni<V> get​(K key,
                                                         Function<K,​V> valueLoader)
        Description copied from interface: Cache
        Returns a lazy asynchronous action that will emit the cache value identified by key, obtaining that value from valueLoader if necessary.
        Specified by:
        get in interface Cache
        Type Parameters:
        K - cache key type
        V - cache value type
        Parameters:
        key - cache key
        valueLoader - function used to compute a cache value if key is not already associated with a value
        Returns:
        a lazy asynchronous action that will emit a cache value
      • invalidate

        public io.smallrye.mutiny.Uni<Void> invalidate​(Object key)
        Description copied from interface: Cache
        Removes the cache entry identified by key from the cache. If the key does not identify any cache entry, nothing will happen.
        Specified by:
        invalidate in interface Cache
        Parameters:
        key - cache key
      • invalidateAll

        public io.smallrye.mutiny.Uni<Void> invalidateAll()
        Description copied from interface: Cache
        Removes all entries from the cache.
        Specified by:
        invalidateAll in interface Cache
      • replaceUniValue

        public io.smallrye.mutiny.Uni<Void> replaceUniValue​(Object key,
                                                            Object emittedValue)
        Description copied from class: AbstractCache
        Replaces the cache value associated with the given key by an item emitted by a Uni. 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:
        replaceUniValue in class AbstractCache
      • keySet

        public Set<Object> keySet()
        Description copied from interface: CaffeineCache
        Returns an unmodifiable Set view of the keys contained in this cache. If the cache entries are modified while an iteration over the set is in progress, the set will remain unchanged.
        Specified by:
        keySet in interface CaffeineCache
        Returns:
        a set view of the keys contained in this cache
      • getSize

        public long getSize()