I am learning to implement cache and I have a situation where I am forming cache value by concatenating startTimestamp and endTimestamp something like the below:
@Cacheable(value = "cacheKey", key = "{#startTs +'|'+ #endTs}")
I want to be able to return the cached value even when the exact date doesn't match. For example, even if there is a cache value existing in the cache db(using redis here) the timestamps(startTs and endTs) of which is 5 mins earlier, it should work.
Sample key - cacheKey::04-20-2024 22:30|04-25-2024 23:30
What I am expecting is even if the startTs and endTs are 04-20-2024 22:35 and 04-25-2024 23:35, it should return the cached response.
I have gone through the documentation and other stackoverflow answers. Didn't seem to have found a proper answer.
Does anyone have any idea how to go about it?
Thanks in advance!