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 anAxelorCache
which 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 anAxelorCache
which either returns an already-loaded value for a given key or atomically computes or retrieves it using the suppliedCacheLoader
.protected RemovalCause
toRemovalCause
(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:CacheBuilder
Builds anAxelorCache
which does not automatically load values when keys are requested.- Specified by:
build
in classCacheBuilder<K,
V> - Type Parameters:
K1
- the key type of the cacheV1
- the value type of the cache- Returns:
- a new
AxelorCache
instance having the specified configuration
-
build
Description copied from class:CacheBuilder
Builds anAxelorCache
which either returns an already-loaded value for a given key or atomically computes or retrieves it using the suppliedCacheLoader
.- Specified by:
build
in classCacheBuilder<K,
V> - Type Parameters:
K1
- the key type of the cacheV1
- the value type of the cache- Parameters:
loader
- theCacheLoader
used to obtain new values- Returns:
- a new
AxelorCache
instance having the specified configuration and using the specified loader
-
toRemovalCause
-