sindresorhus/awesome-nodejs

Add promise-memoize?

puzrin opened this issue · 3 comments

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 commented

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

@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.

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