类 EhCacheManagerUtils
- java.lang.Object
- org.springframework.cache.ehcache.EhCacheManagerUtils
public abstract class EhCacheManagerUtils extends Object
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 usingparseConfiguration(org.springframework.core.io.Resource)
, customizing the configuration object, and then calling theCacheManager(Configuration)
constructor.- 从以下版本开始:
- 4.1
- 作者:
- Juergen Hoeller
构造器概要
构造器 构造器 说明 EhCacheManagerUtils()
方法概要
所有方法 静态方法 具体方法 修饰符和类型 方法 说明 static CacheManager
buildCacheManager()
Build an EhCacheCacheManager
from the default configuration.static CacheManager
buildCacheManager(String name)
Build an EhCacheCacheManager
from the default configuration.static CacheManager
buildCacheManager(String name, Resource configLocation)
Build an EhCacheCacheManager
from the given configuration resource.static CacheManager
buildCacheManager(Resource configLocation)
Build an EhCacheCacheManager
from the given configuration resource.static Configuration
parseConfiguration(Resource configLocation)
Parse EhCache configuration from the given resource, for further use with customCacheManager
creation.
构造器详细资料
EhCacheManagerUtils
public EhCacheManagerUtils()
方法详细资料
buildCacheManager
public static CacheManager buildCacheManager() throws CacheException
Build an EhCacheCacheManager
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.
- 返回:
- the new EhCache CacheManager
- 抛出:
CacheException
- in case of configuration parsing failure
buildCacheManager
public static CacheManager buildCacheManager(String name) throws CacheException
Build an EhCacheCacheManager
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.
- 参数:
name
- the desired name of the cache manager- 返回:
- the new EhCache CacheManager
- 抛出:
CacheException
- in case of configuration parsing failure
buildCacheManager
public static CacheManager buildCacheManager(Resource configLocation) throws CacheException
Build an EhCacheCacheManager
from the given configuration resource.- 参数:
configLocation
- the location of the configuration file (as a Spring resource)- 返回:
- the new EhCache CacheManager
- 抛出:
CacheException
- in case of configuration parsing failure
buildCacheManager
public static CacheManager buildCacheManager(String name, Resource configLocation) throws CacheException
Build an EhCacheCacheManager
from the given configuration resource.- 参数:
name
- the desired name of the cache managerconfigLocation
- the location of the configuration file (as a Spring resource)- 返回:
- the new EhCache CacheManager
- 抛出:
CacheException
- in case of configuration parsing failure
parseConfiguration
public static Configuration parseConfiguration(Resource configLocation) throws CacheException
Parse EhCache configuration from the given resource, for further use with customCacheManager
creation.- 参数:
configLocation
- the location of the configuration file (as a Spring resource)- 返回:
- the EhCache Configuration handle
- 抛出:
CacheException
- in case of configuration parsing failure- 另请参阅:
CacheManager(Configuration)
,CacheManager.create(Configuration)