/** * Set one or more sources to find cache operations. * @see CacheInterceptor#setCacheOperationSources */ public void setCacheOperationSources(CacheOperationSource... cacheOperationSources) { this.cacheInterceptor.setCacheOperationSources(cacheOperationSources); }
/** * Set one or more sources to find cache operations. * @see CacheInterceptor#setCacheOperationSources */ public void setCacheOperationSources(CacheOperationSource... cacheOperationSources) { this.cacheInterceptor.setCacheOperationSources(cacheOperationSources); }
@Bean public CacheInterceptor cacheInterceptor(CacheOperationSource cacheOperationSource) { CacheInterceptor cacheInterceptor = new TestCacheInterceptor(); cacheInterceptor.setCacheManager(cacheManager()); cacheInterceptor.setCacheOperationSources(cacheOperationSource); return cacheInterceptor; } }
/** * Set one or more sources to find cache operations. * @see CacheInterceptor#setCacheOperationSources */ public void setCacheOperationSources(CacheOperationSource... cacheOperationSources) { this.cacheInterceptor.setCacheOperationSources(cacheOperationSources); }
@Configuration @EnableCaching @Profile("test") public class CacheConfig { @Bean @Autowired public CacheManager cacheManager(RedisClientTemplate redisClientTemplate) { return new ConcurrentMapCacheManager(redisClientTemplate, "test"); } @Bean public CacheOperationSource cacheOperationSource() { return new AnnotationCacheOperationSource(); } @Bean public CacheInterceptor cacheInterceptor() { CacheInterceptor interceptor = new MyCacheInterceptor(); interceptor.setCacheOperationSources(cacheOperationSource()); return interceptor; } }