org.springframework.cache.interceptor

## 类 AbstractCacheInvoker

- java.lang.Object
- - org.springframework.cache.interceptor.AbstractCacheInvoker

- 直接已知子类:
    CacheAspectSupport

      public abstract class AbstractCacheInvoker
      extends Object

  A base component for invoking `Cache` operations and using a configurable `CacheErrorHandler` when an exception occurs.
  从以下版本开始:
    4.1
  作者:
    Stephane Nicoll
  另请参阅:
    `CacheErrorHandler`

- - ### 构造器概要

    构造器
    限定符 | 构造器和说明
    --- | ---
    `protected` | `AbstractCacheInvoker()`
    `protected` | `AbstractCacheInvoker(CacheErrorHandler errorHandler)`

  - ### 方法概要

    所有方法 实例方法 具体方法
    限定符和类型 | 方法和说明
    --- | ---
    `protected void` | `doClear(Cache cache)` Execute `Cache.clear()` on the specified `Cache` and invoke the error handler if an exception occurs.
    `protected void` | `doEvict(Cache cache, Object key)` Execute `Cache.evict(Object)` on the specified `Cache` and invoke the error handler if an exception occurs.
    `protected Cache.ValueWrapper` | `doGet(Cache cache, Object key)` Execute `Cache.get(Object)` on the specified `Cache` and invoke the error handler if an exception occurs.
    `protected void` | `doPut(Cache cache, Object key, Object result)` Execute `Cache.put(Object, Object)` on the specified `Cache` and invoke the error handler if an exception occurs.
    `CacheErrorHandler` | `getErrorHandler()` Return the `CacheErrorHandler` to use.
    `void` | `setErrorHandler(CacheErrorHandler errorHandler)` Set the `CacheErrorHandler` instance to use to handle errors thrown by the cache provider.

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

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

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

    - #### AbstractCacheInvoker

          protected AbstractCacheInvoker()

    - #### AbstractCacheInvoker

          protected AbstractCacheInvoker(CacheErrorHandler errorHandler)

  - ### 方法详细资料

    - #### setErrorHandler

          public void setErrorHandler(CacheErrorHandler errorHandler)

      Set the `CacheErrorHandler` instance to use to handle errors thrown by the cache provider. By default, a `SimpleCacheErrorHandler` is used who throws any exception as is.

    - #### getErrorHandler

          public CacheErrorHandler getErrorHandler()

      Return the `CacheErrorHandler` to use.

    - #### doGet

          @Nullable
          protected Cache.ValueWrapper doGet(Cache cache,
                                                        Object key)

      Execute `Cache.get(Object)` on the specified `Cache` and invoke the error handler if an exception occurs. Return `null` if the handler does not throw any exception, which simulates a cache miss in case of error.
      另请参阅:
        `Cache.get(Object)`

    - #### doPut

          protected void doPut(Cache cache,
                               Object key,
                               @Nullable
                               Object result)

      Execute `Cache.put(Object, Object)` on the specified `Cache` and invoke the error handler if an exception occurs.

    - #### doEvict

          protected void doEvict(Cache cache,
                                 Object key)

      Execute `Cache.evict(Object)` on the specified `Cache` and invoke the error handler if an exception occurs.

    - #### doClear

          protected void doClear(Cache cache)

      Execute `Cache.clear()` on the specified `Cache` and invoke the error handler if an exception occurs.