I am using spring cache with Redis for caching
I have the following methods:
@CachePut(value ="DATA1", key = "#key1")
public Object saveData1(long key1, Object obj) {
return obj;
}
@CachePut(value ="DATA2", key = "#key1")
public Object saveData2(long key1, Object obj) {
return obj;
}
This is causing collisions in keys and the data is being overridden.
I want to generate the key with the cache name appended to it.
Like: DATA1-key1, DATA2-key1.
Is it possible?
I have seen a few examples which use class name and method name. But I want to use the cache name.
Thank you.