medikoo / memoizee

Complete memoize/cache solution for JavaScript
ISC License
1.73k stars 61 forks source link

memoize & prefetch promises #49

Closed puzrin closed 8 years ago

puzrin commented 8 years ago

I'm rewriting a lot of code from callbacks to yield + promises. Would like to find a nice solution to memoize results from db in new style.

I can memoize sync function, that return Promise. That looks ok until promise fails - such result should not be reused. Any ideas how to deal with it?

PS. I know i can use old style internals and promisify memoized function, but that's not beautiful.

medikoo commented 8 years ago

There will be dedicated promise mode for that, it's handled at https://github.com/medikoo/memoizee/issues/35 Until then workaround as proposed in comments should be made.

I'm closing it as duplicate of #35

puzrin commented 8 years ago

Thanks! Did not found that issue when created a new one.