我在不同的类中创建了两个方法,并用注释对它们进行了@Cacheable注释,并给出了相同的缓存名称,如下所示:
class MyClass{
@Cacheable(value="inScopeCache")
public Products getProducts() {
//reading data from repository
}
}
class MyNewClass{
@Cacheable(value="inScopeCache")
public NewProducts getProducts() {
//reading data from repository..
}
}
Run Code Online (Sandbox Code Playgroud)
它会起作用吗?如果是的话怎么办?我已经在 spring xml 中正确定义了上述缓存。如果同时调用这两个方法会发生什么?
由于此方法没有参数,因此如何生成密钥?
谢谢哈里什
ehcache ×1