【发布时间】:2015-08-25 15:22:44
【问题描述】:
我有一种方法可以像这样调用另一个@Cacheable 方法:
public ItemDO findMethod2(long itemId) {
this.findMethod1(itemId);
...
}
@Cacheable(value = "Item", key="#itemId", unless="#result == null")
public ItemDO findMethod1(long itemId) {
...
}
如果我直接调用 findMethod1(),缓存会很好地工作。但是,当我调用 findMethod2() 时, findMethod1() 上的缓存会被完全忽略。
难道是 JVM 的诡计将 findMethod1() 内联到 findMethod2() 中?
有没有人遇到过类似的问题?
谢谢!
【问题讨论】:
标签: spring-cache