java - Multiple cache implementations at method level in Spring Boot -
what want is, 2 different cache implementations (let's redis , ehcache) on 1 method. meaning @cacheable
method should cache both redis , ehcache.
is possible?
option 1: stack caches. configure local cache in spring. wire in distributed cache via cacheloader/cachewriter. consistency needs evaluated. e.g. if update goes distributed cache, how invalidate local caches? not trivial. maybe easy , not needed data, maybe near impossible.
option 2: go distributed cache provides called near cache. combination want yourself, combined in product. know hazelcast , infinispan offer near cache. however, mileage may vary regarding consistency , resilience. know hazelcast enhanced near cache, consistent.
interesting use case , common problem. further thoughts , discussion highly appreciated.
Comments
Post a Comment