I've seen lots of examples of using things like Netflix's @HystrixCommand
on service methods, but is it possible to enable a circuit breaker when using one or more CacheManager
instances? In other words, bypass the Spring cache if the underlying service is unavailable or unstable over time.
Specifically, in our usage of Spring Cache, we simply have a method annotated with @Cacheable
. Typically with a circuit breaker you specify a fallback, but our fallback is "Dont' use the cache, just execute our method normally". How would we implement that with annotations? Do we need to refactor our code to separate the CacheManager
calls?