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

onEviction should be called when deleting entries or clearing cache #41

Open
ConPac opened this issue Sep 21, 2022 · 2 comments
Open

onEviction should be called when deleting entries or clearing cache #41

ConPac opened this issue Sep 21, 2022 · 2 comments

Comments

@ConPac
Copy link

ConPac commented Sep 21, 2022

Given that onEviction is "called right before an item is evicted from the cache", it should be called when deleting entries or clearing the cache.

@sindresorhus
Copy link
Owner

Yes, it should do that. This is a bug.

// @please-rewrite

@vladar
Copy link

vladar commented Oct 7, 2022

Explicit delete and eviction are different actions semantically. Not sure if it should be the same callback. That would be a breaking change in our case since on explicit delete we also do an explicit cleanup, so with onEviction firing in this case our cleanup will run twice.

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