revise cache API

- eliminate unneeded methods
+ introduced value wrapper (name still to be decided) to avoid cache race conditions
+ improved name consistency
This commit is contained in:
Costin Leau
2011-05-17 16:50:00 +00:00
parent af1dfd3577
commit 0b917e3f9c
25 changed files with 122 additions and 1372 deletions

View File

@@ -22,7 +22,7 @@ import java.util.concurrent.Callable;
import org.aspectj.lang.annotation.SuppressAjWarnings;
import org.aspectj.lang.reflect.MethodSignature;
import org.springframework.cache.interceptor.CacheAspectSupport;
import org.springframework.cache.interceptor.CacheDefinitionSource;
import org.springframework.cache.interceptor.CacheOperationSource;
/**
* Abstract superaspect for AspectJ cache aspects. Concrete
@@ -46,11 +46,11 @@ public abstract aspect AbstractCacheAspect extends CacheAspectSupport {
/**
* Construct object using the given caching metadata retrieval strategy.
* @param cds {@link CacheDefinitionSource} implementation, retrieving Spring
* @param cos {@link CacheOperationSource} implementation, retrieving Spring
* cache metadata for each joinpoint.
*/
protected AbstractCacheAspect(CacheDefinitionSource... cds) {
setCacheDefinitionSources(cds);
protected AbstractCacheAspect(CacheOperationSource... cos) {
setCacheDefinitionSources(cos);
}
@SuppressAjWarnings("adviceDidNotMatch")
@@ -75,7 +75,7 @@ public abstract aspect AbstractCacheAspect extends CacheAspectSupport {
/**
* Concrete subaspects must implement this pointcut, to identify
* cached methods. For each selected joinpoint, {@link CacheOperationDefinition}
* will be retrieved using Spring's {@link CacheDefinitionSource} interface.
* will be retrieved using Spring's {@link CacheOperationSource} interface.
*/
protected abstract pointcut cacheMethodExecution(Object cachedObject);
}

View File

@@ -16,7 +16,7 @@
package org.springframework.cache.aspectj;
import org.springframework.cache.annotation.AnnotationCacheDefinitionSource;
import org.springframework.cache.annotation.AnnotationCacheOperationSource;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;
@@ -43,7 +43,7 @@ import org.springframework.cache.annotation.Cacheable;
public aspect AnnotationCacheAspect extends AbstractCacheAspect {
public AnnotationCacheAspect() {
super(new AnnotationCacheDefinitionSource(false));
super(new AnnotationCacheOperationSource(false));
}
/**