Top Description Fields Constructors Methods
org.springframework.cache.interceptor

public abstract Class AbstractCacheInvoker

extends Object
Class Inheritance
Known Direct Subclasses
org.springframework.cache.interceptor.CacheAspectSupport
Imports
org.springframework.cache.Cache, org.springframework.lang.Nullable, org.springframework.util.function.SingletonSupplier

A base component for invoking Cache operations and using a configurable CacheErrorHandler when an exception occurs.
Authors
Stephane Nicoll, Juergen Hoeller
Since
4.1
See Also
org.springframework.cache.interceptor.CacheErrorHandler

Field Summary

Modifier and TypeField and Description
protected SingletonSupplier<CacheErrorHandler>

Constructor Summary

AccessConstructor and Description
protected
protected

Method Summary

Modifier and TypeMethod and Description
protected void
doClear(Cache cache, boolean immediate)

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

protected void
doEvict(Cache cache, Object key, boolean immediate)

Execute Cache#evict(Object)/Cache#evictIfPresent(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 value)

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

public CacheErrorHandler
getErrorHandler()

Return the CacheErrorHandler to use.

public void
setErrorHandler(CacheErrorHandler errorHandler)

Set the CacheErrorHandler instance to use to handle errors thrown by the cache provider.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

errorHandlerback to summary
protected SingletonSupplier<CacheErrorHandler> errorHandler

Constructor Detail

AbstractCacheInvokerback to summary
protected AbstractCacheInvoker()
AbstractCacheInvokerback to summary
protected AbstractCacheInvoker(CacheErrorHandler errorHandler)

Method Detail

doClearback to summary
protected void doClear(Cache cache, boolean immediate)

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

doEvictback to summary
protected void doEvict(Cache cache, Object key, boolean immediate)

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

doGetback to summary
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.

Annotations
@Nullable
See Also
Cache#get(Object)
doPutback to summary
protected void doPut(Cache cache, Object key, Object value)

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

getErrorHandlerback to summary
public CacheErrorHandler getErrorHandler()

Return the CacheErrorHandler to use.

setErrorHandlerback to summary
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.