spring-framework / org.springframework.cache.ehcache / EhCacheManagerFactoryBean / setShared

setShared

open fun setShared(shared: Boolean): Unit

Set whether the EhCache CacheManager should be shared (as a singleton at the ClassLoader level) or independent (typically local within the application). Default is "false", creating an independent local instance.

NOTE: This feature allows for sharing this EhCacheManagerFactoryBean's CacheManager with any code calling CacheManager.create() in the same ClassLoader space, with no need to agree on a specific CacheManager name. However, it only supports a single EhCacheManagerFactoryBean involved which will control the lifecycle of the underlying CacheManager (in particular, its shutdown).

This flag overrides "acceptExisting" if both are set, since it indicates the 'stronger' mode of sharing.

See Also
#setCacheManagerName#setAcceptExistingnet.sf.ehcache.CacheManager#create()net.sf.ehcache.CacheManager#CacheManager()