Say I have 2 different bean methods which I want to cache by EhCache:
@Component
public class StatService {
@Cacheable(value = "statCalc")
public int getMeth1(int param) {
// LOGIC1
}
@Cacheable(value = "statCalc")
public int getMeth2(int param) {
// LOGIC2
}
}
I want to reside them in same cache - ehcache.xml:
<cache name="statCalc"
...
/>
The problem is that cache key is generated by input parameters and not by method signature, thus getMeth2(1) can return value cached by getMeth1(1).
What is the easiest way to build key using method name?
P.S. Please, don't mention the fact that using same cache for different methods could be wrong, just help to solve this problem.