My use case is that I want to cache certain request:response in my service caller classes:
public class Abc{
public Response serviceCall(Request r){}
}
public class Memcached{
public Response get(Request r){}
public void put(Request r, Response rs){}
}
I want to use memcached for caching . The request would be the key and value would be the response. Whenever serviceCall() is called I want to check if request is already present in cache if so then return response from the cache. If not then actually execute serviceCall() method and put request:response key:value in memcached
Is there any way in spring to achieve the same.
I did look into @Cacheable here http://www.baeldung.com/spring-cache-tutorial
But I am unable to understand how I make spring use my "Memcached" class, more specifically where do I wire my "Memcached" class so that it is available to class "Abc" in above example
Could you please help . I am working in spring boot completely annotation based and looking for annotation based solution