spring-framework / org.springframework.cache.ehcache / EhCacheManagerUtils

EhCacheManagerUtils

abstract class EhCacheManagerUtils

Convenient builder methods for EhCache 2.5+ CacheManager setup, providing easy programmatic bootstrapping from a Spring-provided resource. This is primarily intended for use within @Bean methods in a Spring configuration class.

These methods are a simple alternative to custom CacheManager setup code. For any advanced purposes, consider using #parseConfiguration, customizing the configuration object, and then calling the CacheManager#CacheManager(Configuration) constructor.

Author
Juergen Hoeller

Since
4.1

Constructors

<init>

EhCacheManagerUtils()

Convenient builder methods for EhCache 2.5+ CacheManager setup, providing easy programmatic bootstrapping from a Spring-provided resource. This is primarily intended for use within @Bean methods in a Spring configuration class.

These methods are a simple alternative to custom CacheManager setup code. For any advanced purposes, consider using #parseConfiguration, customizing the configuration object, and then calling the CacheManager#CacheManager(Configuration) constructor.

Functions

buildCacheManager

open static fun buildCacheManager(): CacheManager
open static fun buildCacheManager(name: String): CacheManager

Build an EhCache CacheManager from the default configuration.

The CacheManager will be configured from "ehcache.xml" in the root of the class path (that is, default EhCache initialization - as defined in the EhCache docs - will apply). If no configuration file can be found, a fail-safe fallback configuration will be used.

open static fun buildCacheManager(configLocation: Resource): CacheManager
open static fun buildCacheManager(name: String, configLocation: Resource): CacheManager

Build an EhCache CacheManager from the given configuration resource.

parseConfiguration

open static fun parseConfiguration(configLocation: Resource): Configuration

Parse EhCache configuration from the given resource, for further use with custom CacheManager creation.