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.
Coverage remained the same at 100.0% when pulling a9579948591e9b60aaa20da97e2d02d92fdbcf00 on icaiyu:master into 46a3a44c1a5f7a4623fd15c89a77f45bd0478198 on muesli:master.
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.