anywhichway/nano-memoize

clearing cache with max age

darkship opened this issue · 3 comments

Hello,

I'm using your lib like this:

const memo = nanomemoize(fn, { maxAge: 7_200_000 })

memo()
...
memo.clear()

While calling memo.clear() clears the cache, the setTimeout is not cleared and the process hangs.

I added the timeout clear and published as 3.0.16. I did not write a unit test to check this (since I am currently out sailing). However, you could test. All existing unit tests pass.

works