Class CaffeineCacheBuilder<K,V>

java.lang.Object
com.axelor.cache.CacheBuilder<K,V>
com.axelor.cache.caffeine.CaffeineCacheBuilder<K,V>
Type Parameters:
K - the type of keys maintained by this cache
V - the type of mapped values

public class CaffeineCacheBuilder<K,V> extends CacheBuilder<K,V>
Caffeine cache builder

This builds an AxelorCache wrapping either a Cache or LoadingCache, because Caffeine uses different interfaces depending on whether the cache is loading.

  • Constructor Details

    • CaffeineCacheBuilder

      public CaffeineCacheBuilder()
    • CaffeineCacheBuilder

      public CaffeineCacheBuilder(String cacheName)
  • Method Details

    • build

      public <K1 extends K, V1 extends V> AxelorCache<K1,V1> build()
      Description copied from class: CacheBuilder
      Builds an AxelorCache which does not automatically load values when keys are requested.
      Specified by:
      build in class CacheBuilder<K,V>
      Type Parameters:
      K1 - the key type of the cache
      V1 - the value type of the cache
      Returns:
      a new AxelorCache instance having the specified configuration
    • build

      public <K1 extends K, V1 extends V> AxelorCache<K1,V1> build(CacheLoader<? super K1,V1> loader)
      Description copied from class: CacheBuilder
      Builds an AxelorCache which either returns an already-loaded value for a given key or atomically computes or retrieves it using the supplied CacheLoader.
      Specified by:
      build in class CacheBuilder<K,V>
      Type Parameters:
      K1 - the key type of the cache
      V1 - the value type of the cache
      Parameters:
      loader - the CacheLoader used to obtain new values
      Returns:
      a new AxelorCache instance having the specified configuration and using the specified loader
    • toRemovalCause

      protected RemovalCause toRemovalCause(com.github.benmanes.caffeine.cache.RemovalCause cause)