Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MutableTTLCache does not evict on time #317

Open
acjay opened this issue Jul 20, 2016 · 2 comments
Open

MutableTTLCache does not evict on time #317

acjay opened this issue Jul 20, 2016 · 2 comments

Comments

@acjay
Copy link

acjay commented Jul 20, 2016

I've been experiencing unexpected behavior with MutableTTLCache not actually evicting expired keys. It seems it only checks for expiration every 1000 puts. I suppose this probably makes sense under certain circumstances, but it isn't documented or configurable.

@acjay
Copy link
Author

acjay commented Jul 21, 2016

Actually, I'm realizing that the line linked to above isn't exactly the source of my problem. My key's aren't being evicted on time, but it doesn't have to do with the put behavior. I'm making reads after the configured expiration time, but I'm not seeing the memoized function being invoked.

Upon further investigation, the problem is that calling the memoized function performs its lookup though hit, which does no expiration checking, unlike get. Is this an oversight? Why does hit exist? Interestingly, hit unconditionally attempts a put, but as mentioned above, pruning only happens every thousandth time.

@pankajroark
Copy link
Contributor

+1 to hit being documented. I looked around and couldn't figure out what it's meant for either. @sritchie any idea?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants