类 EhCacheManagerUtils
- java.lang.Object
- org.springframework.cache.ehcache.EhCacheManagerUtils
public abstract class EhCacheManagerUtils extends Object
Convenient builder methods for EhCache 2.5+CacheManagersetup, providing easy programmatic bootstrapping from a Spring-provided resource. This is primarily intended for use within@Beanmethods in a Spring configuration class.These methods are a simple alternative to custom
CacheManagersetup 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 CacheManagerbuildCacheManager()Build an EhCacheCacheManagerfrom the default configuration.static CacheManagerbuildCacheManager(String name)Build an EhCacheCacheManagerfrom the default configuration.static CacheManagerbuildCacheManager(String name, Resource configLocation)Build an EhCacheCacheManagerfrom the given configuration resource.static CacheManagerbuildCacheManager(Resource configLocation)Build an EhCacheCacheManagerfrom the given configuration resource.static ConfigurationparseConfiguration(Resource configLocation)Parse EhCache configuration from the given resource, for further use with customCacheManagercreation.
构造器详细资料
EhCacheManagerUtils
public EhCacheManagerUtils()
方法详细资料
buildCacheManager
public static CacheManager buildCacheManager() throws CacheException
Build an EhCacheCacheManagerfrom 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 EhCacheCacheManagerfrom 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 EhCacheCacheManagerfrom 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 EhCacheCacheManagerfrom 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 customCacheManagercreation.- 参数:
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)