CacheInterceptor or an
AspectJ aspect.
This enables the underlying Spring caching infrastructure to be used easily to implement an aspect for any aspect system.
Subclasses are responsible for calling relevant methods in the correct order.
Uses the Strategy design pattern. A CacheOperationSource is
used for determining caching operations, a KeyGenerator will build the
cache keys, and a CacheResolver will resolve the actual cache(s) to use.
Note
A cache aspect is serializable but does not perform any actual caching after deserialization.
| Modifier and Type | Class and Description |
|---|---|
| private static class | |
| protected class | |
| private class | |
| protected static class | CacheAspectSupport.CacheOperationMetadata
Metadata of a cache operation that does not depend on a particular invocation which makes it a good candidate for caching. |
| private class | CacheAspectSupport.CachePutListSubscriber
Reactive Streams Subscriber collection for collecting a List to cache. |
| private class | |
| private class | CacheAspectSupport.ReactiveCachingHandler
Inner class to avoid a hard dependency on the Reactive Streams API at runtime. |
| Modifier and Type | Field and Description |
|---|---|
| private BeanFactory | |
| private CacheOperationSource | |
| private SingletonSupplier | |
| private final CacheOperationExpressionEvaluator | |
| public static final String | IGNORE_REACTIVESTREAMS_PROPERTY_NAME
System property that instructs Spring's caching infrastructure to ignore the
presence of Reactive Streams, in particular Reactor's |
| private boolean | |
| private SingletonSupplier | |
| protected final Log | |
| private final Map | |
| private final StandardEvaluationContext | |
| private final CacheAspectSupport. | |
| private static final boolean | |
| private static final boolean |
| Access | Constructor and Description |
|---|---|
| protected |
| Modifier and Type | Method and Description |
|---|---|
| public void | afterPropertiesSet()
Implements org. BeanFactory after it has set all bean properties
and satisfied BeanFactoryAware, ApplicationContextAware etc.
This method allows the bean instance to perform validation of its overall configuration and final initialization when all bean properties have been set. |
| public void | afterSingletonsInstantiated()
Implements org. |
| protected void | |
| private void | collectPutRequests(Collection<CacheAspectSupport.
the contexts to handle contexts,the result value result, Collection<CacheAspectSupport.the collection to update putRequestsCollect a |
| public void | configure(Supplier<CacheErrorHandler> errorHandler, Supplier<KeyGenerator> keyGenerator, Supplier<CacheResolver> cacheResolver, Supplier<CacheManager> cacheManager)
Configure this aspect with the given error handler, key generator and cache resolver/manager suppliers, applying the corresponding default if a supplier is not resolvable. |
| private Object | evaluate(Object cacheHit, CacheOperationInvoker invoker, Method method, CacheAspectSupport.
|
| protected Object | |
| private Object | execute(CacheOperationInvoker invoker, Method method, CacheAspectSupport.
|
| private Object | executeSynchronized(CacheOperationInvoker invoker, Method method, CacheAspectSupport.
|
| private Object | findCachedValue(CacheOperationInvoker invoker, Method method, CacheAspectSupport.
the cacheable operations contextsFind a cached value only for |
| private Object | findInCaches(CacheAspectSupport.
|
| private Object | |
| protected <T> T | |
| protected CacheAspectSupport. | Returns: the resolved metadata for the operationthe operation operation, Method the method on which the operation is invoked method, Class<?> the target type targetClass)Return the |
| public CacheOperationSource | |
| public CacheResolver | |
| protected Collection | |
| public KeyGenerator | |
| protected CacheAspectSupport. | getOperationContext(CacheOperation operation, Method method, Object[] args, Object target, Class<?> targetClass)
|
| private boolean | |
| protected Object | Returns: the result of the invocationthe invoker handling the operation being cached invoker)Execute the underlying operation (typically in case of cache miss) and return the result of the invocation. |
| private boolean | |
| private void | logInvalidating(CacheAspectSupport.
|
| protected String | Returns: log message identifying this methodthe method we're interested in method, Class<?> class the method is on targetClass)Convenience method to return a String representation of this Method for use in logging. |
| private void | |
| private Object | processCacheEvicts(Collection<CacheAspectSupport.
|
| public void | setBeanFactory(BeanFactory
owning BeanFactory (never beanFactory)null).
The bean can immediately call methods on the factory.Implements org. BeanFactory for CacheManager and other
service lookups.
|
| public void | setCacheManager(CacheManager cacheManager)
Set the |
| public void | setCacheOperationSource(CacheOperationSource cacheOperationSource)
Set the CacheOperationSource for this cache aspect. |
| public void | setCacheOperationSources(CacheOperationSource... cacheOperationSources)
Set one or more cache operation sources which are used to find the cache attributes. |
| public void | setCacheResolver(CacheResolver cacheResolver)
Set the default |
| public void | setKeyGenerator(KeyGenerator keyGenerator)
Set the default |
| private Object | |
| private Object | |
| private Object |