@Bean @Role(BeanDefinition.ROLE_INFRASTRUCTURE) public CacheOperationSource cacheOperationSource() { return new AnnotationCacheOperationSource(); }
@Override @Nullable protected Collection<CacheOperation> findCacheOperations(Class<?> clazz) { return determineCacheOperations(parser -> parser.parseCacheAnnotations(clazz)); }
private Collection<CacheOperation> getOps(String name) { Method method = ReflectionUtils.findMethod(AnnotatedClass.class, name, Object.class, Object.class); return this.source.getCacheOperations(method, AnnotatedClass.class); }
@Bean @Role(BeanDefinition.ROLE_INFRASTRUCTURE) public CacheOperationSource cacheOperationSource() { return new AnnotationCacheOperationSource(); }
@Override @Nullable protected Collection<CacheOperation> findCacheOperations(Method method) { return determineCacheOperations(parser -> parser.parseCacheAnnotations(method)); }
private Collection<CacheOperation> getOps(Class<?> target, String name) { try { Method method = target.getMethod(name); return this.source.getCacheOperations(method, target); } catch (NoSuchMethodException ex) { throw new IllegalStateException(ex); } }
@Bean @Role(BeanDefinition.ROLE_INFRASTRUCTURE) public CacheOperationSource cacheOperationSource() { return new AnnotationCacheOperationSource(); }
@Override @Nullable protected Collection<CacheOperation> findCacheOperations(Method method) { return determineCacheOperations(parser -> parser.parseCacheAnnotations(method)); }
@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; } }
@Override @Nullable protected Collection<CacheOperation> findCacheOperations(Class<?> clazz) { return determineCacheOperations(parser -> parser.parseCacheAnnotations(clazz)); }
@Override @Nullable protected Collection<CacheOperation> findCacheOperations(Class<?> clazz) { return determineCacheOperations(parser -> parser.parseCacheAnnotations(clazz)); }
@Override @Nullable protected Collection<CacheOperation> findCacheOperations(Method method) { return determineCacheOperations(parser -> parser.parseCacheAnnotations(method)); }