Java Code Examples for org.springframework.cache.config.CacheableService#multiCache()

The following examples show how to use org.springframework.cache.config.CacheableService#multiCache() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AspectJCacheAnnotationTests.java    From spring-analysis-note with MIT License 6 votes vote down vote up
@Override
public void testMultiEvict(CacheableService<?> service) {
	Object o1 = new Object();

	Object r1 = service.multiCache(o1);
	Object r2 = service.multiCache(o1);

	Cache primary = cm.getCache("primary");
	Cache secondary = cm.getCache("secondary");

	assertSame(r1, r2);
	assertSame(r1, primary.get(o1).get());
	assertSame(r1, secondary.get(o1).get());

	service.multiEvict(o1);
	assertNull(primary.get(o1));
	assertNull(secondary.get(o1));

	Object r3 = service.multiCache(o1);
	Object r4 = service.multiCache(o1);
	assertNotSame(r1, r3);
	assertSame(r3, r4);

	assertSame(r3, primary.get(o1).get());
	assertSame(r4, secondary.get(o1).get());
}
 
Example 2
Source File: AspectJCacheAnnotationTests.java    From java-technology-stack with MIT License 6 votes vote down vote up
@Override
public void testMultiEvict(CacheableService<?> service) {
	Object o1 = new Object();

	Object r1 = service.multiCache(o1);
	Object r2 = service.multiCache(o1);

	Cache primary = cm.getCache("primary");
	Cache secondary = cm.getCache("secondary");

	assertSame(r1, r2);
	assertSame(r1, primary.get(o1).get());
	assertSame(r1, secondary.get(o1).get());

	service.multiEvict(o1);
	assertNull(primary.get(o1));
	assertNull(secondary.get(o1));

	Object r3 = service.multiCache(o1);
	Object r4 = service.multiCache(o1);
	assertNotSame(r1, r3);
	assertSame(r3, r4);

	assertSame(r3, primary.get(o1).get());
	assertSame(r4, secondary.get(o1).get());
}
 
Example 3
Source File: AspectJCacheAnnotationTests.java    From spring4-understanding with Apache License 2.0 6 votes vote down vote up
@Override
public void testMultiEvict(CacheableService<?> service) {
	Object o1 = new Object();

	Object r1 = service.multiCache(o1);
	Object r2 = service.multiCache(o1);

	Cache primary = cm.getCache("primary");
	Cache secondary = cm.getCache("secondary");

	assertSame(r1, r2);
	assertSame(r1, primary.get(o1).get());
	assertSame(r1, secondary.get(o1).get());

	service.multiEvict(o1);
	assertNull(primary.get(o1));
	assertNull(secondary.get(o1));

	Object r3 = service.multiCache(o1);
	Object r4 = service.multiCache(o1);
	assertNotSame(r1, r3);
	assertSame(r3, r4);

	assertSame(r3, primary.get(o1).get());
	assertSame(r4, secondary.get(o1).get());
}