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

cached-fetch - Feature: Self-expiring memory store #4

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

e1himself
Copy link
Contributor

@e1himself e1himself commented Oct 31, 2023

Though this can totally live in the user-land, I thought that it may be a nice addition to the package.

If you think otherwise, feel free to close the PR :)

Thanks!

Copy link
Owner

@y-nk y-nk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i'm really sorry to see this only now ; truth is i have almost no visitors in here so i rarely go to see PRs 😅 happy to merge after your input on this one feedback.

clearTimeout(timers.get(key))
timers.set(
key,
setTimeout(() => store.del(key), ttl),
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
setTimeout(() => store.del(key), ttl),
setTimeout(() => { store.del(key); clearTimeout(timers.get(key)) }, ttl),

i think we need to remove the ref of the timer in the timeout otherwise the happy path would keep the timer ref forever. no?

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

Successfully merging this pull request may close these issues.

2 participants