org.springframework.cache.interceptor

## 类 CacheProxyFactoryBean

- java.lang.Object
- - org.springframework.aop.framework.ProxyConfig
  - - org.springframework.aop.framework.AbstractSingletonProxyFactoryBean
    - - org.springframework.cache.interceptor.CacheProxyFactoryBean

- 所有已实现的接口:
    Serializable, org.springframework.beans.factory.Aware, org.springframework.beans.factory.BeanClassLoaderAware, org.springframework.beans.factory.BeanFactoryAware, org.springframework.beans.factory.FactoryBean<Object>, org.springframework.beans.factory.InitializingBean, org.springframework.beans.factory.SmartInitializingSingleton

      public class CacheProxyFactoryBean
      extends org.springframework.aop.framework.AbstractSingletonProxyFactoryBean
      implements org.springframework.beans.factory.BeanFactoryAware, org.springframework.beans.factory.SmartInitializingSingleton

  Proxy factory bean for simplified declarative caching handling. This is a convenient alternative to a standard AOP `ProxyFactoryBean` with a separate `CacheInterceptor` definition.

  This class is designed to facilitate declarative cache demarcation: namely, wrapping a singleton target object with a caching proxy, proxying all the interfaces that the target implements. Exists primarily for third-party framework integration. Users should favor the `cache:` XML namespace `@Cacheable` annotation. See the declarative annotation-based caching section of the Spring reference documentation for more information.

  从以下版本开始:
    3.1
  作者:
    Costin Leau, Juergen Hoeller
  另请参阅:
    `ProxyFactoryBean`, `CacheInterceptor`, 序列化表格

- - ### 构造器概要

    构造器
    构造器和说明
    `CacheProxyFactoryBean()`

  - ### 方法概要

    所有方法 实例方法 具体方法
    限定符和类型 | 方法和说明
    --- | ---
    `void` | `afterSingletonsInstantiated()`
    `protected Object` | `createMainInterceptor()`
    `void` | `setBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory)`
    `void` | `setCacheManager(CacheManager cacheManager)` Set the `CacheManager` to use to create a default `CacheResolver`.
    `void` | `setCacheOperationSources(CacheOperationSource... cacheOperationSources)` Set one or more sources to find cache operations.
    `void` | `setCacheResolver(CacheResolver cacheResolver)` Set the default `CacheResolver` that this cache aspect should delegate to if no specific cache resolver has been set for the operation.
    `void` | `setKeyGenerator(KeyGenerator keyGenerator)` Set the default `KeyGenerator` that this cache aspect should delegate to if no specific key generator has been set for the operation.
    `void` | `setPointcut(org.springframework.aop.Pointcut pointcut)` Set a pointcut, i.e. a bean that triggers conditional invocation of the `CacheInterceptor` depending on the method and attributes passed.

    - ### 从类继承的方法 org.springframework.aop.framework.AbstractSingletonProxyFactoryBean

      `afterPropertiesSet, createTargetSource, getObject, getObjectType, isSingleton, postProcessProxyFactory, setAdvisorAdapterRegistry, setBeanClassLoader, setPostInterceptors, setPreInterceptors, setProxyClassLoader, setProxyInterfaces, setTarget`

    - ### 从类继承的方法 org.springframework.aop.framework.ProxyConfig

      `copyFrom, isExposeProxy, isFrozen, isOpaque, isOptimize, isProxyTargetClass, setExposeProxy, setFrozen, setOpaque, setOptimize, setProxyTargetClass, toString`

    - ### 从类继承的方法 java.lang.Object

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

- - ### 构造器详细资料

    - #### CacheProxyFactoryBean

          public CacheProxyFactoryBean()

  - ### 方法详细资料

    - #### setCacheOperationSources

          public void setCacheOperationSources(CacheOperationSource... cacheOperationSources)

      Set one or more sources to find cache operations.
      另请参阅:
        `CacheAspectSupport.setCacheOperationSources(org.springframework.cache.interceptor.CacheOperationSource...)`

    - #### setKeyGenerator

          public void setKeyGenerator(KeyGenerator keyGenerator)

      Set the default `KeyGenerator` that this cache aspect should delegate to if no specific key generator has been set for the operation.

      The default is a `SimpleKeyGenerator`.

      从以下版本开始:
        5.0.3
      另请参阅:
        `CacheAspectSupport.setKeyGenerator(org.springframework.cache.interceptor.KeyGenerator)`

    - #### setCacheResolver

          public void setCacheResolver(CacheResolver cacheResolver)

      Set the default `CacheResolver` that this cache aspect should delegate to if no specific cache resolver has been set for the operation.

      The default resolver resolves the caches against their names and the default cache manager.

      从以下版本开始:
        5.0.3
      另请参阅:
        `CacheAspectSupport.setCacheResolver(org.springframework.cache.interceptor.CacheResolver)`

    - #### setCacheManager

          public void setCacheManager(CacheManager cacheManager)

      Set the `CacheManager` to use to create a default `CacheResolver`. Replace the current `CacheResolver`, if any.
      从以下版本开始:
        5.0.3
      另请参阅:
        `CacheAspectSupport.setCacheManager(org.springframework.cache.CacheManager)`

    - #### setPointcut

          public void setPointcut(org.springframework.aop.Pointcut pointcut)

      Set a pointcut, i.e. a bean that triggers conditional invocation of the `CacheInterceptor` depending on the method and attributes passed.

      Note: Additional interceptors are always invoked.

      另请参阅:
        `AbstractSingletonProxyFactoryBean.setPreInterceptors(java.lang.Object[])`, `AbstractSingletonProxyFactoryBean.setPostInterceptors(java.lang.Object[])`

    - #### setBeanFactory

          public void setBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory)

      指定者:
        `setBeanFactory` 在接口中 `org.springframework.beans.factory.BeanFactoryAware`

    - #### afterSingletonsInstantiated

          public void afterSingletonsInstantiated()

      指定者:
        `afterSingletonsInstantiated` 在接口中 `org.springframework.beans.factory.SmartInitializingSingleton`

    - #### createMainInterceptor

          protected Object createMainInterceptor()

      指定者:
        `createMainInterceptor` 在类中 `org.springframework.aop.framework.AbstractSingletonProxyFactoryBean`