Class CaffeineLoadingCache<K,V>

java.lang.Object
com.axelor.cache.caffeine.CaffeineCache<K,V>
com.axelor.cache.caffeine.CaffeineLoadingCache<K,V>
Type Parameters:
K - the type of keys maintained by this cache
V - the type of mapped values
All Implemented Interfaces:
AxelorCache<K,V>, Closeable, AutoCloseable, Iterable<Map.Entry<K,V>>

public class CaffeineLoadingCache<K,V> extends CaffeineCache<K,V>
Caffeine loading cache

This wraps a LoadingCache.

  • Constructor Details

    • CaffeineLoadingCache

      public CaffeineLoadingCache(com.github.benmanes.caffeine.cache.LoadingCache<K,V> cache)
  • Method Details

    • get

      public V get(K key)
      Description copied from interface: AxelorCache
      Returns the value associated with the key in this cache, obtaining that value from the CacheLoader if defined and if necessary, otherwise returns null if there is no cached value for the key.
      Specified by:
      get in interface AxelorCache<K,V>
      Overrides:
      get in class CaffeineCache<K,V>
      Parameters:
      key - the key whose associated value is to be returned
      Returns:
      the value to which the specified key is mapped, or null if this map contains no mapping for the key
    • getAll

      public Map<K,V> getAll(Set<K> keys)
      Description copied from interface: AxelorCache
      Returns a map of the values associated with the keys in this cache, using CacheLoader if defined and if necessary.
      Specified by:
      getAll in interface AxelorCache<K,V>
      Overrides:
      getAll in class CaffeineCache<K,V>
      Parameters:
      keys - the keys whose associated values are to be returned
      Returns:
      an unmodifiable mapping of keys to values for the specified keys in this cache