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
Otter seems to be internally using Unix timestamps in seconds for expiry. It still allows setting TTL in any time.Duration. Then, if for example Duration of time.Millisecond TTL is used, the cache expiry does not really work as intended.
To Reproduce
Steps to reproduce the behavior:
Use WithTTL(time.Millisecond * 100)
Set to cache
Sleep for 200ms
Can still read the entry
Expected behavior
Either do not allow setting under 1 second TTL or use more granular time than seconds for expiry.
The text was updated successfully, but these errors were encountered:
Hi, I wouldn't say it's a bug. That's how it was originally designed, since I can't imagine a scenario in which ttl is needed for less than a second. I think this will be fixed in v2, but I don't see any good reasons to replace it in v1, to be honest.
Description
Otter seems to be internally using Unix timestamps in seconds for expiry. It still allows setting TTL in any time.Duration. Then, if for example Duration of time.Millisecond TTL is used, the cache expiry does not really work as intended.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Either do not allow setting under 1 second TTL or use more granular time than seconds for expiry.
The text was updated successfully, but these errors were encountered: