2 Home
gitea_admin edited this page 2026-03-11 14:36:30 +00:00

Caffeine LoadCache

Perform caching operations using Caffeine Cache with an attached CacheLoader.

Metadata

Property Value
Scheme caffeine-loadcache
Support Level Stable
Labels cache,clustering
Version 4.10.2

Maven Dependency

<dependency>
    <groupId>org.apache.camel</groupId>
    <artifactId>camel-caffeine</artifactId>
    <version>4.10.2</version>
</dependency>

Endpoint Properties

Name Type Required Default Description
cacheName string the cache name
action string To configure the default cache action. If an action is set in the message header, then the operation from the header takes precedence.
createCacheIfNotExist boolean true Automatic create the Caffeine cache if none has been configured or exists in the registry.
evictionType object SIZE_BASED Set the eviction Type for this cache
expireAfterAccessTime integer 300 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.
expireAfterWriteTime integer 300 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.
initialCapacity integer 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.
key string To configure the default action key. If a key is set in the message header, then the key from the header takes precedence.
maximumSize integer 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.
lazyStartProducer boolean false Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel's routing error handlers. Beware that when the first message is processed then creating and starting the producer may take a little time and prolong the total processing time of the processing.
cacheLoader object To configure a CacheLoader in case of a LoadCache use
removalListener object Set a specific removal Listener for the cache
statsCounter object Set a specific Stats Counter for the cache stats
statsEnabled boolean false To enable stats on the cache
valueType string The cache value type, default java.lang.Object