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

clearing cache for _.memoize question #1269

Closed
hippich opened this issue Jun 8, 2015 · 3 comments
Closed

clearing cache for _.memoize question #1269

hippich opened this issue Jun 8, 2015 · 3 comments
Labels

Comments

@hippich
Copy link

hippich commented Jun 8, 2015

So I found I can clear cache by setting func.cache.data to empty object, but not sure if this is appropriate. What is general recommendation on this? Should new .cache property be created, or it is appropriate just clear .cache.data?

@hippich
Copy link
Author

hippich commented Jun 8, 2015

Looking through WeakMap documentation on mozilla website I found that WeakMap implements .clear() method. If I make a PR with similar modification to the API, will it be considered?

@jdalton
Copy link
Member

jdalton commented Jun 8, 2015

Clearing isn't enforced because devs can use a WeakMap which doesn't have clear and I wanted to keep our default interface small. If you'd like to clear caches I'd recommend using a Map (and its shim if needed) for the cache backing _.memoize.Cache = Map.

@lock
Copy link

lock bot commented Jan 20, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Jan 20, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Development

No branches or pull requests

2 participants