Skip to content

refreshAfterWrite not allowed to nullify non-expired keys? #1808

Closed Answered by ben-manes
SHxKM asked this question in Q&A
Discussion options

You must be logged in to vote

Sorry, I'm unsure what the question is. A refresh to a null value should remove the entry. The various loads try to follow their Map compute counterpart, here a refresh is an asynchronous computeIfPresent. If you implement the CacheLoader explicitly then you can override reload or asyncReload to leverage the old value. The asyncReload is the callback and you can delay the future, e.g. to batch reloads or simply never complete one. If the entry is updated, removed, or evicted then the in-flight reload will be abandoned as the cache tries to have linearizable semantics for reasoning against (or close enough to be a good mental model). I'm not sure if any of that helped but let me know eithe…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by ben-manes
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants