Skip to content

[BUG] Using TTL lower that time.Second does not work #115

Open
@Lanchez

Description

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:

  1. Use WithTTL(time.Millisecond * 100)
  2. Set to cache
  3. Sleep for 200ms
  4. 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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions