I am using ehcache for caching the method results. The key has to be a combination of both member object and method's parameter. My class looks something like:
Class A {
private B b;
@Cacheable(value="someCache",key="some key based on B and C")
public Result getResult(C c){
......
}
I need the key to be based on B and C. I referred https://code.google.com/p/ehcache-spring-annotations/issues/detail?id=69 but they did not specify how to include the method parameter in the key generation. Could someone help me with this?
you can access the A object with root.target in the key. e.g.
key="#root.target.b.id+'-'+#c.id"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With