I am trying to setup L1 + L2 caching strategy to use with @Cacheable
annotation. My objective is
- Configure Caffeine Cache
- Configure Redis Cache
- Look up item in Caffeine Cache, if found return, else step 4
- Look up item in Redis Cache, if found return and cache in caffeine, else step 5
- Use real service to return the result.
I know this is not supported out of the box, but i have been trying to read the documentation on how to go about wiring up such a solution.
My current solution is to wrap my actual service is a RedisBackedService
which has the redisCacheManager
on the cacheable
annotation which in turn is wrapped in a CaffeineBackedService
which has a caffeineCacheManager
on the cacheable
annotation. Needless to say it seems redundant.
Any pointers would be helpful.