use of org.springframework.cache.interceptor.CacheableOperation in project spring-framework by spring-projects.
the class AnnotationCacheOperationSourceTests method multipleStereotypes.
@Test
public void multipleStereotypes() throws Exception {
Collection<CacheOperation> ops = getOps(AnnotatedClass.class, "multipleStereotype", 3);
Iterator<CacheOperation> it = ops.iterator();
assertTrue(it.next() instanceof CacheableOperation);
CacheOperation next = it.next();
assertTrue(next instanceof CacheEvictOperation);
assertTrue(next.getCacheNames().contains("foo"));
next = it.next();
assertTrue(next instanceof CacheEvictOperation);
assertTrue(next.getCacheNames().contains("bar"));
}
use of org.springframework.cache.interceptor.CacheableOperation in project spring-framework by spring-projects.
the class AnnotationCacheOperationSourceTests method cacheAnnotationOverride.
@Test
public void cacheAnnotationOverride() {
Collection<CacheOperation> ops = getOps(InterfaceCacheConfig.class, "interfaceCacheableOverride");
assertSame(1, ops.size());
CacheOperation cacheOperation = ops.iterator().next();
assertTrue(cacheOperation instanceof CacheableOperation);
}
use of org.springframework.cache.interceptor.CacheableOperation in project spring-framework by spring-projects.
the class SpringCacheAnnotationParser method parseCacheableAnnotation.
CacheableOperation parseCacheableAnnotation(AnnotatedElement ae, DefaultCacheConfig defaultConfig, Cacheable cacheable) {
CacheableOperation.Builder builder = new CacheableOperation.Builder();
builder.setName(ae.toString());
builder.setCacheNames(cacheable.cacheNames());
builder.setCondition(cacheable.condition());
builder.setUnless(cacheable.unless());
builder.setKey(cacheable.key());
builder.setKeyGenerator(cacheable.keyGenerator());
builder.setCacheManager(cacheable.cacheManager());
builder.setCacheResolver(cacheable.cacheResolver());
builder.setSync(cacheable.sync());
defaultConfig.applyDefault(builder);
CacheableOperation op = builder.build();
validateCacheOperation(ae, op);
return op;
}
Aggregations