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

is expired logical mis-written? #75

Open
bingoohuang opened this issue Mar 15, 2020 · 2 comments
Open

is expired logical mis-written? #75

bingoohuang opened this issue Mar 15, 2020 · 2 comments

Comments

@bingoohuang
Copy link

https://github.com/coocood/freecache/blob/master/segment.go#L181

expired := oldHdr.expireAt != 0 && oldHdr.expireAt < now

It is more logical for :

expired := oldHdr.expireAt != 0 && oldHdr.expireAt > now

@coocood
Copy link
Owner

coocood commented Mar 15, 2020

Have you met any issue in your application?
The expire feature does not work as expected?

@bingoohuang
Copy link
Author

bingoohuang commented Mar 15, 2020

i just read the code related to expiring process and found that. i just change oldHdr.expireAt < now to oldHdr.expireAt > now and then run the go test ./..., the result is passed, maybe there is no test to cover the line.

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