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

Add promise-memoize? #588

Closed
puzrin opened this issue Sep 28, 2016 · 3 comments
Closed

Add promise-memoize? #588

puzrin opened this issue Sep 28, 2016 · 3 comments

Comments

@puzrin
Copy link
Contributor

puzrin commented Sep 28, 2016

https://github.com/nodeca/promise-memoize is it good for this list?

  • There are a lot of sync memoizers, but almost none for Promise-returning functions with good cache strategies
  • There is https://github.com/medikoo/memoizee universal solution, but
    • it's very complicated inside (because tries to do everything - sync / cb / promises) and is more big in browser
    • my practice shows that after migrating from callbacks to (co + yield) in node 4+, promise-fn memoiser is enougth for everything.

I'd suggest to add both. memoizee is universal, and promise-memoize is just clear and awesome :) .

@kevva
Copy link
Contributor

kevva commented Sep 28, 2016

mem is on the list under the misc section which does the same :).

@kevva kevva closed this as completed Sep 28, 2016
@puzrin
Copy link
Contributor Author

puzrin commented Sep 28, 2016

@keva, mem is just a sync cache with expire:

  • It's not useable for Promise, because in most case you should not cache errors
  • Most async caches do not care about preferch and put cache to cold state on expire.

So, mem is for completely different things.

@sindresorhus
Copy link
Owner

@puzrin For promise-memoize, sure, do a PR.

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

3 participants