Skip to content

Question about TinyFLU #663

Answered by ben-manes
javafanboy asked this question in Q&A
Feb 6, 2022 · 6 comments · 6 replies
Discussion options

You must be logged in to vote

Yes, the policy will make choices that could cause it to aggressively remove recent arrivals. A good scenario is a loop, where the most recent entry's next access is the furthest out in the future. This would cause an LRU to fully miss, whereas MRU is optimal. Caffeine's policy is adaptive and can optimize to the workload.

In your case an EvictionListener is likely the most suitable, which is called atomically with the hash table operation. The other alternative is a RemovalListener which is called asynchronously afterwards, which is ideal for reducing critical sections but may not be ideal if you cannot tolerate out-of-order events for a given key.

Replies: 6 comments 6 replies

Comment options

You must be logged in to vote
4 replies
@javafanboy
Comment options

@ben-manes
Comment options

@ben-manes
Comment options

@javafanboy
Comment options

Answer selected by ben-manes
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@ben-manes
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@ben-manes
Comment options

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