类 AbstractCacheManager
- java.lang.Object
- org.springframework.cache.support.AbstractCacheManager
- 所有已实现的接口:
InitializingBean,CacheManager
public abstract class AbstractCacheManager extends Object implements CacheManager, InitializingBean
Abstract base class implementing the commonCacheManagermethods. Useful for 'static' environments where the backing caches do not change.- 从以下版本开始:
- 3.1
- 作者:
- Costin Leau, Juergen Hoeller, Stephane Nicoll
构造器概要
构造器 构造器 说明 AbstractCacheManager()
方法概要
所有方法 实例方法 抽象方法 具体方法 已过时的方法 修饰符和类型 方法 说明 protected voidaddCache(Cache cache)已过时。as of Spring 4.3, in favor ofgetMissingCache(String)voidafterPropertiesSet()Invoked by the containingBeanFactoryafter it has set all bean properties and satisfiedBeanFactoryAware,ApplicationContextAwareetc.protected CachedecorateCache(Cache cache)Decorate the given Cache object if necessary.CachegetCache(String name)Get the cache associated with the given name.Collection<String>getCacheNames()Get a collection of the cache names known by this manager.protected CachegetMissingCache(String name)Return a missing cache with the specifiedname, ornullif such a cache does not exist or could not be created on demand.voidinitializeCaches()Initialize the static configuration of caches.protected abstract Collection<? extends Cache>loadCaches()Load the initial caches for this cache manager.protected CachelookupCache(String name)Check for a registered cache of the given name.
构造器详细资料
AbstractCacheManager
public AbstractCacheManager()
方法详细资料
afterPropertiesSet
public void afterPropertiesSet()
从接口复制的说明:InitializingBeanInvoked by the containingBeanFactoryafter it has set all bean properties and satisfiedBeanFactoryAware,ApplicationContextAwareetc.This method allows the bean instance to perform validation of its overall configuration and final initialization when all bean properties have been set.
- 指定者:
afterPropertiesSet在接口中InitializingBean
initializeCaches
public void initializeCaches()
Initialize the static configuration of caches.Triggered on startup through
afterPropertiesSet(); can also be called to re-initialize at runtime.- 从以下版本开始:
- 4.2.2
- 另请参阅:
loadCaches()
loadCaches
protected abstract Collection<? extends Cache> loadCaches()
Load the initial caches for this cache manager.Called by
afterPropertiesSet()on startup. The returned collection may be empty but must not benull.
getCache
public Cache getCache(String name)
从接口复制的说明:CacheManagerGet the cache associated with the given name.Note that the cache may be lazily created at runtime if the native provider supports it.
- 指定者:
getCache在接口中CacheManager- 参数:
name- the cache identifier (must not benull)- 返回:
- the associated cache, or
nullif such a cache does not exist or could be not created
getCacheNames
public Collection<String> getCacheNames()
从接口复制的说明:CacheManagerGet a collection of the cache names known by this manager.- 指定者:
getCacheNames在接口中CacheManager- 返回:
- the names of all caches known by the cache manager
lookupCache
protected final Cache lookupCache(String name)
Check for a registered cache of the given name. In contrast togetCache(String), this method does not trigger the lazy creation of missing caches viagetMissingCache(String).- 参数:
name- the cache identifier (must not benull)- 返回:
- the associated Cache instance, or
nullif none found - 从以下版本开始:
- 4.1
- 另请参阅:
getCache(String),getMissingCache(String)
addCache
@Deprecated protected final void addCache(Cache cache)
已过时。as of Spring 4.3, in favor ofgetMissingCache(String)Dynamically register an additional Cache with this manager.- 参数:
cache- the Cache to register
decorateCache
protected Cache decorateCache(Cache cache)
Decorate the given Cache object if necessary.- 参数:
cache- the Cache object to be added to this CacheManager- 返回:
- the decorated Cache object to be used instead, or simply the passed-in Cache object by default
getMissingCache
protected Cache getMissingCache(String name)
Return a missing cache with the specifiedname, ornullif such a cache does not exist or could not be created on demand.Caches may be lazily created at runtime if the native provider supports it. If a lookup by name does not yield any result, an
AbstractCacheManagersubclass gets a chance to register such a cache at runtime. The returned cache will be automatically added to this cache manager.- 参数:
name- the name of the cache to retrieve- 返回:
- the missing cache, or
nullif no such cache exists or could be created on demand - 从以下版本开始:
- 4.1
- 另请参阅:
getCache(String)