public class GrailsAnnotationCacheOperationSource
extends java.lang.Object
implements org.springframework.cache.interceptor.CacheOperationSource, java.io.Serializable
Modifier and Type | Class and Description |
---|---|
protected static class |
GrailsAnnotationCacheOperationSource.DefaultCacheKey
Default cache key for the CacheOperation cache.
|
Modifier and Type | Field and Description |
---|---|
protected java.util.Set<org.springframework.cache.annotation.CacheAnnotationParser> |
annotationParsers |
protected grails.core.GrailsApplication |
application |
protected java.util.Map<java.lang.Object,java.util.Collection<org.springframework.cache.interceptor.CacheOperation>> |
attributeCache
Cache of CacheOperations, keyed by DefaultCacheKey (Method + target Class).
|
static java.lang.String |
BEAN_NAME |
protected org.slf4j.Logger |
logger |
protected static java.util.Collection<org.springframework.cache.interceptor.CacheOperation> |
NULL_CACHING_ATTRIBUTE
Canonical value held in cache to indicate no caching attribute was
found for this method and we don't need to look again.
|
protected boolean |
publicMethodsOnly |
Constructor and Description |
---|
GrailsAnnotationCacheOperationSource()
Constructor.
|
Modifier and Type | Method and Description |
---|---|
protected java.util.Collection<org.springframework.cache.interceptor.CacheOperation> |
computeCacheOperations(java.lang.reflect.Method method,
java.lang.Class<?> targetClass) |
protected java.util.Collection<org.springframework.cache.interceptor.CacheOperation> |
doGetCacheOperations(java.lang.reflect.Method method,
java.lang.Class<?> targetClass)
Determine the caching attribute for this method invocation.
|
protected java.util.Collection<org.springframework.cache.interceptor.CacheOperation> |
findCacheOperations(java.lang.Class<?> clazz) |
protected java.util.Collection<org.springframework.cache.interceptor.CacheOperation> |
findCacheOperations(java.lang.reflect.Method method) |
protected java.lang.Object |
getCacheKey(java.lang.reflect.Method method,
java.lang.Class<?> targetClass)
Determine a cache key for the given method and target class.
|
java.util.Collection<org.springframework.cache.interceptor.CacheOperation> |
getCacheOperations(java.lang.reflect.Method method,
java.lang.Class<?> targetClass) |
java.util.Collection<org.springframework.cache.interceptor.CacheOperation> |
getCacheOperations(java.lang.reflect.Method method,
java.lang.Class<?> targetClass,
boolean includeControllers) |
protected boolean |
isControllerClass(java.lang.Class<?> targetClass) |
void |
reset()
For dev mode when rediscovering annotations is needed.
|
void |
setAllowPublicMethodsOnly(boolean allow)
Dependency injection for whether to only consider public methods
|
void |
setGrailsApplication(grails.core.GrailsApplication grailsApplication)
Dependency injection for the grails application.
|
public static final java.lang.String BEAN_NAME
protected static final java.util.Collection<org.springframework.cache.interceptor.CacheOperation> NULL_CACHING_ATTRIBUTE
protected grails.core.GrailsApplication application
protected boolean publicMethodsOnly
protected org.slf4j.Logger logger
protected final java.util.Set<org.springframework.cache.annotation.CacheAnnotationParser> annotationParsers
protected final java.util.Map<java.lang.Object,java.util.Collection<org.springframework.cache.interceptor.CacheOperation>> attributeCache
public GrailsAnnotationCacheOperationSource()
public java.util.Collection<org.springframework.cache.interceptor.CacheOperation> getCacheOperations(java.lang.reflect.Method method, java.lang.Class<?> targetClass, boolean includeControllers)
public java.util.Collection<org.springframework.cache.interceptor.CacheOperation> getCacheOperations(java.lang.reflect.Method method, java.lang.Class<?> targetClass)
getCacheOperations
in interface org.springframework.cache.interceptor.CacheOperationSource
protected java.util.Collection<org.springframework.cache.interceptor.CacheOperation> doGetCacheOperations(java.lang.reflect.Method method, java.lang.Class<?> targetClass)
Defaults to the class's caching attribute if no method attribute is found.
method
- the method for the current invocation (never null
)targetClass
- the target class for this invocation (may be null
)CacheOperation
for this method, or null
if the method
is not cacheablepublic void reset()
protected java.lang.Object getCacheKey(java.lang.reflect.Method method, java.lang.Class<?> targetClass)
Must not produce same key for overloaded methods. Must produce same key for different instances of the same method.
method
- the method (never null
)targetClass
- the target class (may be null
)null
)protected java.util.Collection<org.springframework.cache.interceptor.CacheOperation> computeCacheOperations(java.lang.reflect.Method method, java.lang.Class<?> targetClass)
protected java.util.Collection<org.springframework.cache.interceptor.CacheOperation> findCacheOperations(java.lang.Class<?> clazz)
protected java.util.Collection<org.springframework.cache.interceptor.CacheOperation> findCacheOperations(java.lang.reflect.Method method)
protected boolean isControllerClass(java.lang.Class<?> targetClass)
public void setGrailsApplication(grails.core.GrailsApplication grailsApplication)
grailsApplication
- the apppublic void setAllowPublicMethodsOnly(boolean allow)
allow
-