-
|
Hi, I'm trying to understand some details of Say, I set up a cache as: If I'm reading the documentation right, it goes as this:
That is, refresh only affects future calls, but not the one triggered it. is that right? Then, there's |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
|
I think the use-case was if you have a local + remote cache and broadcast an invalidation message on a distributed topic. Then you might proactively reload the contents, e.g. if a configuration change. An |
Beta Was this translation helpful? Give feedback.
Sorry, busy day and I focused on the last question only.
Yes, the refresh assists for the future requests and not the one that triggered it. Technically if the
asyncReloadreturns an immediateCompletableFuturethen its value is returned, but since reloads are non-blocking a concurrent read would still observe the current (stale) value. Since the future may take a while to complete, the current value is returned until the future is resolved or the entry is otherwise evicted (e.g. it expired). In the case where the entry was updated or removed then the reload is abandoned and its value forwarded to the removal listener.The feature is sometimes referred to as soft vs hard time-to-live (our…