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

.has() method for custom cache is never called. Should be removed from documentation? #77

Open
uazure opened this issue Jul 18, 2019 · 2 comments

Comments

@uazure
Copy link

uazure commented Jul 18, 2019

I tried to use this memoizer for fuction with 5 arguments, and I implemented the custom cache with .get() .set() and .has() methods

We have 100% test coverage rule for our code. And after running tests I see that .has() method is never called. I checked the source code for fast-memoize and I see no usage of .has() method at all.

So, either documentation should be updated to not mention the .has() method as it is not required, or the code was overoptimized and instead of calling .has() and then .get() you assume that if .get() returns undefined, it means that it wasn't stored. If that's the case, please add this to documentation to manage expectations of library users better.

@caiogondim
Copy link
Owner

Hi there... 👋
Could you share the code you are using so I can better investigate?

@caiogondim
Copy link
Owner

I remember we at some point removed has call for speed purposes.
If we used has, we would need to call has and get in order to get a value from cache.
Nowadays we use only get, removing the need to call has. One call only to check and get values from cache.

We might change this in the future, so I don't want to change the docs.

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

No branches or pull requests

2 participants