+ fix internal cache causing the multiple annotations key/conditions to overlap
This commit is contained in:
Costin Leau
2011-11-30 15:21:09 +00:00
parent 91c14bd1fe
commit 0a611aa776
8 changed files with 48 additions and 24 deletions

View File

@@ -307,6 +307,8 @@ public abstract class AbstractAnnotationTests {
public void testMultiEvict(CacheableService<?> service) {
Object o1 = new Object();
Object o2 = o1.toString() + "A";
Object r1 = service.multiCache(o1);
Object r2 = service.multiCache(o1);
@@ -314,6 +316,7 @@ public abstract class AbstractAnnotationTests {
Cache primary = cm.getCache("primary");
Cache secondary = cm.getCache("secondary");
primary.put(o2, o2);
assertSame(r1, r2);
assertSame(r1, primary.get(o1).get());
assertSame(r1, secondary.get(o1).get());
@@ -321,6 +324,7 @@ public abstract class AbstractAnnotationTests {
service.multiEvict(o1);
assertNull(primary.get(o1));
assertNull(secondary.get(o1));
assertNull(primary.get(o2));
Object r3 = service.multiCache(o1);
Object r4 = service.multiCache(o1);

View File

@@ -116,7 +116,7 @@ public class AnnotatedClassCacheableService implements CacheableService<Object>
return counter.getAndIncrement();
}
@Caching(evict = { @CacheEvict("primary"), @CacheEvict(value = "secondary", key = "#p0") })
@Caching(evict = { @CacheEvict("primary"), @CacheEvict(value = "secondary", key = "#p0"), @CacheEvict(value = "primary", key = "#p0 + 'A'") })
public Object multiEvict(Object arg1) {
return counter.getAndIncrement();
}

View File

@@ -122,7 +122,7 @@ public class DefaultCacheableService implements CacheableService<Long> {
return counter.getAndIncrement();
}
@Caching(evict = { @CacheEvict("primary"), @CacheEvict(value = "secondary", key = "#p0") })
@Caching(evict = { @CacheEvict("primary"), @CacheEvict(value = "secondary", key = "#p0"), @CacheEvict(value = "primary", key = "#p0 + 'A'") })
public Long multiEvict(Object arg1) {
return counter.getAndIncrement();
}