You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Every expirationCheck will iterate all items including the permanent items and and non-permanent items. I think it unnecessary to check the permanent items, why not store them to another map so that the expirationCheck checks the non-permanent items only.
Plus..
I think that using 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) .
In a nutshell, the cleanupTimer is really close to call expirationCheck as time goes by, however, the cleanupInterval remains unchanged!
Since we couldn't get the countdown time of the cleanupTimer directly, note down the cleaning time as cleanupTime is helpful to make it.
I submit a PR. If I was wrong please correct me and I will be really grateful. Thank you in advance!
Establish a map to storage the eternal items so that ExpirationCheck don't have to check them in the iteration ? why not?
The text was updated successfully, but these errors were encountered: