类 AbstractCacheInvoker
- java.lang.Object
- org.springframework.cache.interceptor.AbstractCacheInvoker
public abstract class AbstractCacheInvoker extends Object
A base component for invokingCache
operations and using a configurableCacheErrorHandler
when an exception occurs.- 从以下版本开始:
- 4.1
- 作者:
- Stephane Nicoll, Juergen Hoeller
- 另请参阅:
CacheErrorHandler
字段概要
字段 修饰符和类型 字段 说明 protected SingletonSupplier<CacheErrorHandler>
errorHandler
构造器概要
构造器 限定符 构造器 说明 protected
AbstractCacheInvoker()
protected
AbstractCacheInvoker(CacheErrorHandler errorHandler)
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 protected void
doClear(Cache cache, boolean immediate)
ExecuteCache.clear()
on the specifiedCache
and invoke the error handler if an exception occurs.protected void
doEvict(Cache cache, Object key, boolean immediate)
ExecuteCache.evict(Object)
/Cache.evictIfPresent(Object)
on the specifiedCache
and invoke the error handler if an exception occurs.protected Cache.ValueWrapper
doGet(Cache cache, Object key)
ExecuteCache.get(Object)
on the specifiedCache
and invoke the error handler if an exception occurs.protected void
doPut(Cache cache, Object key, Object result)
ExecuteCache.put(Object, Object)
on the specifiedCache
and invoke the error handler if an exception occurs.CacheErrorHandler
getErrorHandler()
Return theCacheErrorHandler
to use.void
setErrorHandler(CacheErrorHandler errorHandler)
Set theCacheErrorHandler
instance to use to handle errors thrown by the cache provider.
字段详细资料
errorHandler
protected SingletonSupplier<CacheErrorHandler> errorHandler
构造器详细资料
AbstractCacheInvoker
protected AbstractCacheInvoker()
AbstractCacheInvoker
protected AbstractCacheInvoker(CacheErrorHandler errorHandler)
方法详细资料
setErrorHandler
public void setErrorHandler(CacheErrorHandler errorHandler)
Set theCacheErrorHandler
instance to use to handle errors thrown by the cache provider. By default, aSimpleCacheErrorHandler
is used who throws any exception as is.
getErrorHandler
public CacheErrorHandler getErrorHandler()
Return theCacheErrorHandler
to use.
doGet
@Nullable protected Cache.ValueWrapper doGet(Cache cache, Object key)
ExecuteCache.get(Object)
on the specifiedCache
and invoke the error handler if an exception occurs. Returnnull
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)
ExecuteCache.put(Object, Object)
on the specifiedCache
and invoke the error handler if an exception occurs.
doEvict
protected void doEvict(Cache cache, Object key, boolean immediate)
ExecuteCache.evict(Object)
/Cache.evictIfPresent(Object)
on the specifiedCache
and invoke the error handler if an exception occurs.
doClear
protected void doClear(Cache cache, boolean immediate)
ExecuteCache.clear()
on the specifiedCache
and invoke the error handler if an exception occurs.