我正在使用 ehcache 来缓存方法结果。键必须是成员对象和方法参数的组合。我的课程看起来像这样:
Class A {
private B b;
@Cacheable(value="someCache",key="some key based on B and C")
public Result getResult(C c){
......
}
我需要基于B和C的密钥。
我提到https://code.google.com/p/ehcache-spring-annotations/issues/detail?id=69 https://code.google.com/p/ehcache-spring-annotations/issues/detail?id=69但他们没有指定如何在密钥生成中包含方法参数。有人可以帮我解决这个问题吗?
您可以访问A
对象与root.target
在钥匙中。例如
key="#root.target.b.id+'-'+#c.id"
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)