Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

setex does not remove the key when use command keys #361

Open
ddo opened this issue Mar 23, 2018 · 1 comment
Open

setex does not remove the key when use command keys #361

ddo opened this issue Mar 23, 2018 · 1 comment

Comments

@ddo
Copy link

ddo commented Mar 23, 2018

setex(test, 5, 'test val')
get(test)
> 'test val'
# delay 5s
get(test)
> null
keys()
> test
@mishan
Copy link
Contributor

mishan commented Oct 4, 2019

Hm, interesting. get should be deleting the key, though keys is also missing a cleanup for expired keys. something like this:

      keys() {
        const keys = Object.keys(raw);
        keys.forEach(key => {
          if (expires.has(key) && expires.isExpired(key)) {
            this.delete(key);
          }
        });
        return Object.keys(raw);
      },

However I need to write some tests for this.

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

No branches or pull requests

3 participants