Class CaffeineConfiguration
java.lang.Object
org.apache.camel.component.caffeine.CaffeineConfiguration
- All Implemented Interfaces:
Cloneable
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncopy()com.github.benmanes.caffeine.cache.CacheLoaderintintgetKey()com.github.benmanes.caffeine.cache.RemovalListenercom.github.benmanes.caffeine.cache.stats.StatsCounterbooleanbooleanvoidTo configure the default cache action.voidsetCacheLoader(com.github.benmanes.caffeine.cache.CacheLoader cacheLoader) To configure a CacheLoader in case of a LoadCache usevoidsetCreateCacheIfNotExist(boolean createCacheIfNotExist) Automatic create the Caffeine cache if none has been configured or exists in the registry.voidsetEvictionType(EvictionType evictionType) Set the eviction Type for this cachevoidsetExpireAfterAccessTime(int expireAfterAccessTime) Specifies that each entry should be automatically removed from the cache once a fixed duration has elapsed after the entry's creation, the most recent replacement of its value, or its last read.voidsetExpireAfterWriteTime(int expireAfterWriteTime) Specifies that each entry should be automatically removed from the cache once a fixed duration has elapsed after the entry's creation, or the most recent replacement of its value.voidsetInitialCapacity(int initialCapacity) Sets the minimum total size for the internal data structures.voidTo configure the default action key.voidsetMaximumSize(Integer maximumSize) Specifies the maximum number of entries the cache may contain.voidsetRemovalListener(com.github.benmanes.caffeine.cache.RemovalListener removalListener) Set a specific removal Listener for the cachevoidsetStatsCounter(com.github.benmanes.caffeine.cache.stats.StatsCounter statsCounter) Set a specific Stats Counter for the cache statsvoidsetStatsEnabled(boolean statsEnabled) To enable stats on the cachevoidsetValueType(String valueType) The cache value type, default "java.lang.Object"
-
Constructor Details
-
CaffeineConfiguration
public CaffeineConfiguration()
-
-
Method Details
-
isCreateCacheIfNotExist
public boolean isCreateCacheIfNotExist() -
setCreateCacheIfNotExist
public void setCreateCacheIfNotExist(boolean createCacheIfNotExist) Automatic create the Caffeine cache if none has been configured or exists in the registry. -
getAction
-
setAction
To configure the default cache action. If an action is set in the message header, then the operation from the header takes precedence. -
getKey
-
setKey
To configure the default action key. If a key is set in the message header, then the key from the header takes precedence. -
getValueType
-
setValueType
The cache value type, default "java.lang.Object" -
getCacheLoader
public com.github.benmanes.caffeine.cache.CacheLoader getCacheLoader() -
setCacheLoader
public void setCacheLoader(com.github.benmanes.caffeine.cache.CacheLoader cacheLoader) To configure a CacheLoader in case of a LoadCache use -
isStatsEnabled
public boolean isStatsEnabled() -
setStatsEnabled
public void setStatsEnabled(boolean statsEnabled) To enable stats on the cache -
getInitialCapacity
-
setInitialCapacity
public void setInitialCapacity(int initialCapacity) Sets the minimum total size for the internal data structures. Providing a large enough estimate at construction time avoids the need for expensive resizing operations later, but setting this value unnecessarily high wastes memory. -
getMaximumSize
-
setMaximumSize
Specifies the maximum number of entries the cache may contain. Note that the cache may evict an entry before this limit is exceeded or temporarily exceed the threshold while evicting. As the cache size grows close to the maximum, the cache evicts entries that are less likely to be used again. For example, the cache may evict an entry because it hasn't been used recently or very often. When size is zero, elements will be evicted immediately after being loaded into the cache. This can be useful in testing or to disable caching temporarily without a code change. As eviction is scheduled on the configured executor, tests may instead prefer to configure the cache to execute tasks directly on the same thread. -
getEvictionType
-
setEvictionType
Set the eviction Type for this cache -
getExpireAfterAccessTime
public int getExpireAfterAccessTime() -
setExpireAfterAccessTime
public void setExpireAfterAccessTime(int expireAfterAccessTime) Specifies that each entry should be automatically removed from the cache once a fixed duration has elapsed after the entry's creation, the most recent replacement of its value, or its last read. Access time is reset by all cache read and write operations. The unit is in seconds. -
getExpireAfterWriteTime
public int getExpireAfterWriteTime() -
setExpireAfterWriteTime
public void setExpireAfterWriteTime(int expireAfterWriteTime) Specifies that each entry should be automatically removed from the cache once a fixed duration has elapsed after the entry's creation, or the most recent replacement of its value. The unit is in seconds. -
getRemovalListener
public com.github.benmanes.caffeine.cache.RemovalListener getRemovalListener() -
setRemovalListener
public void setRemovalListener(com.github.benmanes.caffeine.cache.RemovalListener removalListener) Set a specific removal Listener for the cache -
getStatsCounter
public com.github.benmanes.caffeine.cache.stats.StatsCounter getStatsCounter() -
setStatsCounter
public void setStatsCounter(com.github.benmanes.caffeine.cache.stats.StatsCounter statsCounter) Set a specific Stats Counter for the cache stats -
copy
-