+ add support for multiple cache names
+ require each annotation to specify a cache name
+ add method support in Key generator interface
+ add bug fix for embedded JDK concurrent declaration
This commit is contained in:
Costin Leau
2010-12-16 13:19:01 +00:00
parent 21d64a74ae
commit faf01b0337
17 changed files with 159 additions and 94 deletions

View File

@@ -24,7 +24,7 @@ import org.springframework.cache.annotation.Cacheable;
/**
* @author Costin Leau
*/
@Cacheable
@Cacheable("default")
public class AnnotatedClassCacheableService implements CacheableService {
private AtomicLong counter = new AtomicLong();
@@ -37,11 +37,11 @@ public class AnnotatedClassCacheableService implements CacheableService {
return null;
}
@CacheEvict
@CacheEvict("default")
public void invalidate(Object arg1) {
}
@Cacheable(key = "#p0")
@Cacheable(value = "default", key = "#p0")
public Object key(Object arg1, Object arg2) {
return counter.getAndIncrement();
}

View File

@@ -31,21 +31,21 @@ public class DefaultCacheableService implements CacheableService<Long> {
private AtomicLong counter = new AtomicLong();
@Cacheable
@Cacheable("default")
public Long cache(Object arg1) {
return counter.getAndIncrement();
}
@CacheEvict
@CacheEvict("default")
public void invalidate(Object arg1) {
}
@Cacheable(condition = "#classField == 3")
@Cacheable(value = "default", condition = "#classField == 3")
public Long conditional(int classField) {
return counter.getAndIncrement();
}
@Cacheable(key = "#p0")
@Cacheable(value = "default", key = "#p0")
public Long key(Object arg1, Object arg2) {
return counter.getAndIncrement();
}