Top Description Methods
org.springframework.cache.interceptor

public Interface CacheOperationSource

Known Direct Implementers
org.springframework.cache.interceptor.CompositeCacheOperationSource, org.springframework.cache.interceptor.NameMatchCacheOperationSource, org.springframework.cache.interceptor.AbstractFallbackCacheOperationSource
Imports
java.lang.reflect.Method, java.util.Collection, org.springframework.lang.Nullable

Interface used by CacheInterceptor. Implementations know how to source cache operation attributes, whether from configuration, metadata attributes at source level, or elsewhere.
Authors
Costin Leau, Juergen Hoeller
Since
3.1

Method Summary

Modifier and TypeMethod and Description
public Collection<CacheOperation>

Returns:

all cache operations for this method, or null if none found
getCacheOperations
(Method
the method to introspect
method
,
Class<?>
the target class (may be null, in which case the declaring class of the method must be used)
targetClass
)

Return the collection of cache operations for this method, or null if the method contains no cacheable annotations.

public default boolean

Returns:

false if the class is known to have no cache operation metadata at class or method level; true otherwise. The default implementation returns true, leading to regular introspection.
isCandidateClass
(Class<?>
the class to introspect
targetClass
)

Determine whether the given class is a candidate for cache operations in the metadata format of this CacheOperationSource.

Method Detail

getCacheOperationsback to summary
public Collection<CacheOperation> getCacheOperations(Method method, Class<?> targetClass)

Return the collection of cache operations for this method, or null if the method contains no cacheable annotations.

Parameters
method:Method

the method to introspect

targetClass:Class<?>

the target class (may be null, in which case the declaring class of the method must be used)

Returns:Collection<CacheOperation>

all cache operations for this method, or null if none found

Annotations
@Nullable
isCandidateClassback to summary
public default boolean isCandidateClass(Class<?> targetClass)

Determine whether the given class is a candidate for cache operations in the metadata format of this CacheOperationSource.

If this method returns false, the methods on the given class will not get traversed for getCacheOperations introspection. Returning false is therefore an optimization for non-affected classes, whereas true simply means that the class needs to get fully introspected for each method on the given class individually.

Parameters
targetClass:Class<?>

the class to introspect

Returns:boolean

false if the class is known to have no cache operation metadata at class or method level; true otherwise. The default implementation returns true, leading to regular introspection.

Since
5.2