Skip to content

Expire by time before starting value computation #1801

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

You must be logged in to vote

Correct, the time after the write completes and not when it starts. You could track that yourself and use a custom Expiry to adjust.

If what you’re observing is a linearization problem, not expiration, then you’ll need another approach. An invalidateAll (Map.clear) is unable to observe in-flight loads because they are suppressed by ConcurrentHashMap’s iterator. Those would have to be tracked separately as key operations, like Map.remove, are linearizable. Another approach is to use a generation id as part of the key, so that entries from previous generations can’t be fetched and are eventually evicted.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@erkieh
Comment options

Answer selected by ben-manes
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