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
As @XuehaiPan pointed out in #219 and #220, the current way of determining expiration time is somewhat awkward when using small integer TTLs and/or integer-based timers. For example, with ttl=1, an item will expire at timer() + 2 if timer() returns only integer values. Replacing
link.expire < self.__timer()
with
link.expire <= self.__timer()
throughout ttl.py would probably make this behave more intuitively.
This would be a breaking change, but it is probably safe to expect that most application will use the default timer and shouldn't be affected. Adding another option to the TTLCache constructor for specifying expiration behavior has already been dismissed as too complex.
Note that this will fundamentally change the behavior of ttl=0, but that's probably only relevant for unit tests.
The text was updated successfully, but these errors were encountered:
As @XuehaiPan pointed out in #219 and #220, the current way of determining expiration time is somewhat awkward when using small integer TTLs and/or integer-based timers. For example, with
ttl=1
, an item will expire attimer() + 2
iftimer()
returns only integer values. Replacingwith
throughout
ttl.py
would probably make this behave more intuitively.This would be a breaking change, but it is probably safe to expect that most application will use the default
timer
and shouldn't be affected. Adding another option to theTTLCache
constructor for specifying expiration behavior has already been dismissed as too complex.Note that this will fundamentally change the behavior of
ttl=0
, but that's probably only relevant for unit tests.The text was updated successfully, but these errors were encountered: