Package org.springframework.cache.interceptor

# Class SimpleCacheResolver

java.lang.Object
org.springframework.cache.interceptor.AbstractCacheResolver
org.springframework.cache.interceptor.SimpleCacheResolver

All Implemented Interfaces:
  `org.springframework.beans.factory.InitializingBean`, `CacheResolver`

public class SimpleCacheResolver extends AbstractCacheResolver
A simple `CacheResolver` that resolves the `Cache` instance(s) based on a configurable `CacheManager` and the name of the cache(s) as provided by `getCacheNames()`.

Since:
  4.1
Author:
  Stephane Nicoll, Juergen Hoeller
See Also:
  - `BasicOperation.getCacheNames()`

## Constructor Summary

Constructors
Constructor
Description
`SimpleCacheResolver()`
Construct a new `SimpleCacheResolver`.
`SimpleCacheResolver(CacheManager cacheManager)`
Construct a new `SimpleCacheResolver` for the given `CacheManager`.

## Method Summary

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.

### Methods inherited from class org.springframework.cache.interceptor.AbstractCacheResolver

`afterPropertiesSet, getCacheManager, resolveCaches, setCacheManager`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### SimpleCacheResolver

public SimpleCacheResolver()
Construct a new `SimpleCacheResolver`.

See Also:
  - `AbstractCacheResolver.setCacheManager(org.springframework.cache.CacheManager)`

### SimpleCacheResolver

public SimpleCacheResolver(CacheManager cacheManager)
Construct a new `SimpleCacheResolver` for the given `CacheManager`.

Parameters:
  `cacheManager` - the CacheManager to use

## Method Details

### 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 class `AbstractCacheResolver`
Parameters:
  `context` - the context of the particular invocation
Returns:
  the cache name(s) to resolve, or `null` if no cache should be resolved