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

using the cleanupTime to checkExpiration instead of cleanupInterval #31

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

icaiyu
Copy link

@icaiyu icaiyu commented May 28, 2019

I notice that let cleanupInterval to check the expiration is not that efficient.
Like this example:
Add an item with lifespan = 10 to a blank table, the cleanupInterval will be 10s,

6s later, add another item with lifespan = 8, it will call the table.expirationcheck()
because item.lifespan < cleanupInteval
in fact, it's unnecessary to check because 10 - 6 < 8 (the cleanupTimer countdown to 10-6 = 4) . Since we couldn't get the countdown time of the cleanupTimer directly, note down the cleaning time as cleanupTime is helpful to make it.

@coveralls
Copy link

coveralls commented May 28, 2019

Coverage Status

Coverage remained the same at 100.0% when pulling a957994 on icaiyu:master into 46a3a44 on muesli:master.

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

Successfully merging this pull request may close these issues.

None yet

2 participants