Class CacheAspectSupport

java.lang.Object
org.springframework.cache.interceptor.AbstractCacheInvoker
org.springframework.cache.interceptor.CacheAspectSupport
All Implemented Interfaces:
org.springframework.beans.factory.Aware, org.springframework.beans.factory.BeanFactoryAware, org.springframework.beans.factory.InitializingBean, org.springframework.beans.factory.SmartInitializingSingleton
Direct Known Subclasses:
CacheInterceptor

public abstract class CacheAspectSupport extends AbstractCacheInvoker implements org.springframework.beans.factory.BeanFactoryAware, org.springframework.beans.factory.InitializingBean, org.springframework.beans.factory.SmartInitializingSingleton
Base class for caching aspects, such as the 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.

Since:
3.1
Author:
Costin Leau, Juergen Hoeller, Chris Beams, Phillip Webb, Sam Brannen, Stephane Nicoll, Sebastien Deleuze
  • Field Details

    • IGNORE_REACTIVESTREAMS_PROPERTY_NAME

      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 Mono/Flux in Cacheable method return type declarations.

      By default, as of 6.1, Reactive Streams Publishers such as Reactor's Mono/Flux will be specifically processed for asynchronous caching of their produced values rather than trying to cache the returned Publisher instances themselves.

      Switch this flag to "true" in order to ignore Reactive Streams Publishers and process them as regular return values through synchronous caching, restoring 6.0 behavior. Note that this is not recommended and only works in very limited scenarios, e.g. with manual Mono.cache()/Flux.cache() calls.

      Since:
      6.1.3
      See Also:
    • logger

      protected final org.apache.commons.logging.Log logger
  • Constructor Details

    • CacheAspectSupport

      protected CacheAspectSupport()
  • Method Details