open class CaffeineCacheManager : CacheManager
CacheManager implementation that lazily builds CaffeineCache instances for each #getCache request. Also supports a 'static' mode where the set of cache names is pre-defined through #setCacheNames, with no dynamic creation of further cache regions at runtime.
The configuration of the underlying cache can be fine-tuned through a Caffeine builder or CaffeineSpec, passed into this CacheManager through #setCaffeine/#setCaffeineSpec. A CaffeineSpec-compliant expression value can also be applied via the "cacheSpecification" bean property.
Requires Caffeine 2.1 or higher.
Author
Ben Manes
Author
Juergen Hoeller
Author
Stephane Nicoll
Since
4.3
See Also
CaffeineCache
CaffeineCacheManager()
Construct a dynamic CaffeineCacheManager, lazily creating cache instances as they are being requested. CaffeineCacheManager(vararg cacheNames: String)
Construct a static CaffeineCacheManager, managing caches for the specified cache names only. |
open fun getCache(name: String): Cache |
|
open fun getCacheNames(): MutableCollection<String> |
|
open fun isAllowNullValues(): Boolean
Return whether this cache manager accepts and converts |
|
open fun setAllowNullValues(allowNullValues: Boolean): Unit
Specify whether to accept and convert Default is "true", despite Caffeine itself not supporting |
|
open fun setCacheLoader(cacheLoader: CacheLoader<Any, Any>): Unit
Set the Caffeine CacheLoader to use for building each individual CaffeineCache instance, turning it into a LoadingCache. |
|
open fun setCacheNames(cacheNames: MutableCollection<String>): Unit
Specify the set of cache names for this CacheManager's 'static' mode. The number of caches and their names will be fixed after a call to this method, with no creation of further cache regions at runtime. Calling this with a |
|
open fun setCacheSpecification(cacheSpecification: String): Unit
Set the Caffeine cache specification String to use for building each individual CaffeineCache instance. The given value needs to comply with Caffeine's CaffeineSpec (see its javadoc). |
|
open fun setCaffeine(caffeine: Caffeine<Any, Any>): Unit
Set the Caffeine to use for building each individual CaffeineCache instance. |
|
open fun setCaffeineSpec(caffeineSpec: CaffeineSpec): Unit
Set the CaffeineSpec to use for building each individual CaffeineCache instance. |