Package com.axelor.cache.caffeine
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 cacheV- the type of mapped values
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<K1 extends K,V1 extends V>
AxelorCache<K1, V1> build()Builds anAxelorCachewhich does not automatically load values when keys are requested.<K1 extends K,V1 extends V>
AxelorCache<K1, V1> build(CacheLoader<? super K1, V1> loader) Builds anAxelorCachewhich either returns an already-loaded value for a given key or atomically computes or retrieves it using the suppliedCacheLoader.protected RemovalCausetoRemovalCause(com.github.benmanes.caffeine.cache.RemovalCause cause) Methods inherited from class com.axelor.cache.CacheBuilder
expireAfterAccess, expireAfterWrite, fromCacheName, getCacheName, getCacheProviderInfo, getCacheType, getExpireAfterAccess, getExpireAfterWrite, getMaximumSize, getRemovalListener, isWeakKeys, isWeakValues, maximumSize, newBuilder, newInMemoryBuilder, removalListener, weakKeys, weakValues
-
Constructor Details
-
CaffeineCacheBuilder
public CaffeineCacheBuilder() -
CaffeineCacheBuilder
-
-
Method Details
-
build
Description copied from class:CacheBuilderBuilds anAxelorCachewhich does not automatically load values when keys are requested.- Specified by:
buildin classCacheBuilder<K,V> - Type Parameters:
K1- the key type of the cacheV1- the value type of the cache- Returns:
- a new
AxelorCacheinstance having the specified configuration
-
build
Description copied from class:CacheBuilderBuilds anAxelorCachewhich either returns an already-loaded value for a given key or atomically computes or retrieves it using the suppliedCacheLoader.- Specified by:
buildin classCacheBuilder<K,V> - Type Parameters:
K1- the key type of the cacheV1- the value type of the cache- Parameters:
loader- theCacheLoaderused to obtain new values- Returns:
- a new
AxelorCacheinstance having the specified configuration and using the specified loader
-
toRemovalCause
-