Add property to enable Caffeine async cache mode

CaffeineCacheManager supports asynchronous caches backed by Caffeine's
AsyncCache via setAsyncCacheMode, which adds support for Cache.retrieve.

Add a spring.cache.caffeine.async property (default false) wired to
CaffeineCacheManager.setAsyncCacheMode in CaffeineCacheConfiguration.

See gh-51844

Signed-off-by: seonghun lee <harrisleesh@gmail.com>
This commit is contained in:
seonghun lee
2026-09-28 10:12:51 +02:00
committed by Stéphane Nicoll
parent 0eed305ce0
commit 4e4cdc3fda
4 changed files with 43 additions and 0 deletions
@@ -223,6 +223,8 @@ If a javadoc:com.github.benmanes.caffeine.cache.CacheLoader[] bean is defined, i
Since the javadoc:com.github.benmanes.caffeine.cache.CacheLoader[] is going to be associated with _all_ caches managed by the cache manager, it must be defined as `CacheLoader<Object, Object>`.
The auto-configuration ignores any other generic type.
To expose asynchronous caches backed by Caffeine's javadoc:com.github.benmanes.caffeine.cache.AsyncCache[], adding support for `Cache.retrieve`, set configprop:spring.cache.caffeine.async[] to `true`.
[[io.caching.provider.cache2k]]