clearing cache with max age
darkship opened this issue · 3 comments
darkship commented
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.
anywhichway commented
Thanks, I will look into it over the next couple of days.
…________________________________
From: Thomas ***@***.***>
Sent: Thursday, November 16, 2023 8:59:23 AM
To: anywhichway/nano-memoize ***@***.***>
Cc: Subscribed ***@***.***>
Subject: [anywhichway/nano-memoize] clearing cache with max age (Issue #63)
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<https://github.com/anywhichway/nano-memoize/blob/ca71d163db33fc894584133d3dc942cfb404f382/src/index.js#L44C46-L44C46> is not cleared and the process hangs.
—
Reply to this email directly, view it on GitHub<#63>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/ABF2US2AMSF3ZU3LOY2GA5LYEZA6XAVCNFSM6AAAAAA7OPMVPCVHI2DSMVQWIX3LMV43ASLTON2WKOZRHE4TOMZRHE2TMMA>.
You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
anywhichway commented
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.
darkship commented
works