@Caching
能够为一个提供多个缓存配置
@Caching(
cacheable = {
@Cacheable(value = "emp",key = "#lastName")
},
put = {
@CachePut(value = "emp",key = "#result.id"),
@CachePut(value = "emp",key = "#result.email"),
}
)
CacheConfig
属于类级别注解
@CacheConfig(cacheNames = "default")
//让类中缓冲注解共享以上的数据
public class TestA {
private static int step = 1;
@Cacheable()
public int aRun1(int i) {
i += step;
i++;
return i;
}
@CacheEvict(allEntries = true)
public void clear() {}
@CachePut()
public int update(int i) {
i += step;
i++;
return i;
}
}