Class NamedCacheResolver
- java.lang.Object
- org.springframework.cache.interceptor.AbstractCacheResolver
- org.springframework.cache.interceptor.NamedCacheResolver
- All Implemented Interfaces:
InitializingBean
,CacheResolver
public class NamedCacheResolver extends AbstractCacheResolver
ACacheResolver
that forces the resolution to a configurable collection of name(s) against a givenCacheManager
.- Since:
- 4.1
- Author:
- Stephane Nicoll
Constructor Summary
Constructors Constructor Description NamedCacheResolver()
NamedCacheResolver(CacheManager cacheManager, String... cacheNames)
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Collection<String>
getCacheNames(CacheOperationInvocationContext<?> context)
Provide the name of the cache(s) to resolve against the current cache manager.void
setCacheNames(Collection<String> cacheNames)
Set the cache name(s) that this resolver should use.Methods inherited from class org.springframework.cache.interceptor.AbstractCacheResolver
afterPropertiesSet, getCacheManager, resolveCaches, setCacheManager
Constructor Detail
NamedCacheResolver
public NamedCacheResolver()
NamedCacheResolver
public NamedCacheResolver(CacheManager cacheManager, String... cacheNames)
Method Detail
setCacheNames
public void setCacheNames(Collection<String> cacheNames)
Set the cache name(s) that this resolver should use.
getCacheNames
protected Collection<String> getCacheNames(CacheOperationInvocationContext<?> context)
Description copied from class:AbstractCacheResolver
Provide the name of the cache(s) to resolve against the current cache manager.It is acceptable to return
null
to indicate that no cache could be resolved for this invocation.- Specified by:
getCacheNames
in classAbstractCacheResolver
- Parameters:
context
- the context of the particular invocation- Returns:
- the cache name(s) to resolve, or
null
if no cache should be resolved