I have used spring @Cacheable for caching as shown below:
@Cacheable
public Response mycall(Request request)
Now I want this method call to be cached only if request.getId()!=3, where getId()
is a public getter method in Request class.
I have seen code wherein people have specified unless
condition in @Cacheable
, but I have seen conditions being specified only on Response of the method and not on Request. Reference: How do I tell Spring cache not to cache null value in @Cacheable annotation
Is there any way to achieve the same with condition being specified on a field of the request