use of cn.taketoday.cache.interceptor.CacheableOperation in project today-infrastructure by TAKETODAY.
the class AnnotationCacheOperationSourceTests method cacheAnnotationOverride.
@Test
public void cacheAnnotationOverride() {
Collection<CacheOperation> ops = getOps(InterfaceCacheConfig.class, "interfaceCacheableOverride");
assertThat(ops.size()).isSameAs(1);
CacheOperation cacheOperation = ops.iterator().next();
assertThat(cacheOperation instanceof CacheableOperation).isTrue();
}
use of cn.taketoday.cache.interceptor.CacheableOperation in project today-framework by TAKETODAY.
the class AnnotationCacheOperationSourceTests method cacheAnnotationOverride.
@Test
public void cacheAnnotationOverride() {
Collection<CacheOperation> ops = getOps(InterfaceCacheConfig.class, "interfaceCacheableOverride");
assertThat(ops.size()).isSameAs(1);
CacheOperation cacheOperation = ops.iterator().next();
assertThat(cacheOperation instanceof CacheableOperation).isTrue();
}
use of cn.taketoday.cache.interceptor.CacheableOperation in project today-framework by TAKETODAY.
the class AnnotationCacheOperationSourceTests method multipleStereotypes.
@Test
public void multipleStereotypes() {
Collection<CacheOperation> ops = getOps(AnnotatedClass.class, "multipleStereotype", 3);
Iterator<CacheOperation> it = ops.iterator();
assertThat(it.next() instanceof CacheableOperation).isTrue();
CacheOperation next = it.next();
assertThat(next instanceof CacheEvictOperation).isTrue();
assertThat(next.getCacheNames().contains("foo")).isTrue();
next = it.next();
assertThat(next instanceof CacheEvictOperation).isTrue();
assertThat(next.getCacheNames().contains("bar")).isTrue();
}
use of cn.taketoday.cache.interceptor.CacheableOperation in project today-framework by TAKETODAY.
the class DefaultCacheAnnotationParser method parseCacheableAnnotation.
private 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;
}
use of cn.taketoday.cache.interceptor.CacheableOperation in project today-infrastructure by TAKETODAY.
the class DefaultCacheAnnotationParser method parseCacheableAnnotation.
private 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