-
Notifications
You must be signed in to change notification settings - Fork 86
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
configure cache size #8
Comments
It is possible. I see the API as: memoize(func, {
cacheLimit: 256
}) Thoughts about it? |
it sounds good to me. Is Additional suggestion: Leonardo |
About the default equality check: I see it as a responsibility of the cache itself. And you can already pass a custom cache as There is no documentation for it. I will update README. |
if you can add some examples of custom cache would be great. |
Documentation on usage of custom cache and serializer 187d14c |
Isn't |
@almirfilho It's not on the source code. |
Another idea is to check for |
A very nice feature would be to allow a cache size of 1 to replicate |
This shouldn't be included into this package because its API allows a custom cache handler. A quick implementation of a sized cache could be:
Test suite:
|
Here there is a method to set the cache size limit combining this package with 2 others, without the need to add any change to fast-memoize. |
The main point is that the memoizer's cache must have a limit in order to use this in production. Otherwise it could grow forever which is obviously a problem. |
I agree with @peacechen , it doesn't seem reasonable to have an unlimited cache in the first place, this is a huge footgun. I can see having an optional |
Is it possible to configure the max cache size?
I took a look at the source and noticed that the simple cache (Object cache) applies no limits.
I am not very comfortable to use knowing that memory could eventually blow up the browser in a matter of time.
The text was updated successfully, but these errors were encountered: