Package org.springframework.cache.jcache.interceptor

# Class JCacheInterceptor

java.lang.Object
org.springframework.cache.interceptor.AbstractCacheInvoker
org.springframework.cache.jcache.interceptor.JCacheAspectSupport
org.springframework.cache.jcache.interceptor.JCacheInterceptor

All Implemented Interfaces:
  `Serializable`, `org.aopalliance.aop.Advice`, `org.aopalliance.intercept.Interceptor`, `org.aopalliance.intercept.MethodInterceptor`, `org.springframework.beans.factory.InitializingBean`

public class JCacheInterceptor extends JCacheAspectSupport implements org.aopalliance.intercept.MethodInterceptor, Serializable
AOP Alliance MethodInterceptor for declarative cache management using JSR-107 caching annotations.

Derives from the `JCacheAspectSupport` class which contains the integration with Spring's underlying caching API. JCacheInterceptor simply calls the relevant superclass method.

JCacheInterceptors are thread-safe.

Since:
  4.1
Author:
  Stephane Nicoll, Juergen Hoeller
See Also:
  - `CacheInterceptor`
  - Serialized Form

## Field Summary

### Fields inherited from class org.springframework.cache.jcache.interceptor.JCacheAspectSupport

`logger`

### Fields inherited from class org.springframework.cache.interceptor.AbstractCacheInvoker

`errorHandler`

## Constructor Summary

Constructors
Constructor
Description
`JCacheInterceptor()`
Construct a new `JCacheInterceptor` with the default error handler.
`JCacheInterceptor(Supplier<org.springframework.cache.interceptor.CacheErrorHandler> errorHandler)`
Construct a new `JCacheInterceptor` with the given error handler.

## Method Summary

Modifier and Type
Method
Description
`Object`
`invoke(org.aopalliance.intercept.MethodInvocation invocation)`

### Methods inherited from class org.springframework.cache.jcache.interceptor.JCacheAspectSupport

`afterPropertiesSet, execute, getCacheOperationSource, invokeOperation, setCacheOperationSource`

### Methods inherited from class org.springframework.cache.interceptor.AbstractCacheInvoker

`doClear, doEvict, doGet, doGet, doPut, doRetrieve, doRetrieve, getErrorHandler, setErrorHandler`

### Methods inherited from class java.lang.Object

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

## Constructor Details

### JCacheInterceptor

public JCacheInterceptor()
Construct a new `JCacheInterceptor` with the default error handler.

### JCacheInterceptor

public JCacheInterceptor(@Nullable Supplier<org.springframework.cache.interceptor.CacheErrorHandler> errorHandler)
Construct a new `JCacheInterceptor` with the given error handler.

Parameters:
  `errorHandler` - a supplier for the error handler to use, applying the default error handler if the supplier is not resolvable
Since:
  5.1

## Method Details

### invoke

@Nullable public Object invoke(org.aopalliance.intercept.MethodInvocation invocation) throws Throwable

Specified by:
  `invoke` in interface `org.aopalliance.intercept.MethodInterceptor`
Throws:
  `Throwable`