Using RetryPolicy/Failsafe with LoadingCache using refreshAfterWrite #1785
Replies: 1 comment 2 replies
-
There is an example showing the two used together. The cache does not support storing null values, as it mirrors Often retry policies have a backoff between attempts, which extends the lock hold times. For a synchronous cache you might want to retry outside of the cache if the locking becomes a problem, which will memoize but could allow multiple threads to interleave their their retries for the same entry. The async cache is friendlier by doing the work in a future, which failsafe nicely handles with its own async support. |
Beta Was this translation helpful? Give feedback.
-
Hello!
I'm hoping to get some expert advice on this topic.
I have a caching implementation that looks like this:
Is it possible/recommended to add a retry mechanism to this setup using the RetryPolicy and Failsafe?
The problem is that a failed fetchAndDecodeCacheEntry() call results in null being cached as the value for the given dateKey until effectiveCacheEntryLifetimeMins expires.
I'm trying to keep the code as simple as possible but I'm guessing it will get rather more complex in order to achieve these goals.
Appreciate any suggestions, thoughts, etc.
Cheers,
Mark
Beta Was this translation helpful? Give feedback.
All reactions