medikoo / memoizee

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

Added note about params coerce #3

Closed puzrin closed 12 years ago

puzrin commented 12 years ago

User can miss, that arrays / objects / functions must be coerced, when used as params. Then memoise will not work as expected and can cause memory leak.

Added note to readme.

medikoo commented 12 years ago

@puzrin thanks for that.

Problem is that this description gives false view in my opinion. In many cases you work with objects and expect default behavior. I approach it many times when I want to memoize by objects as they are in memory, without any serialization.

Your point is valid when talking about collections, which we want to memoize by their content, and not by self objects, or when talking about functions that we want to memoize by their code representation. I've prepared similar note to yours, that straightens that point: https://github.com/medikoo/memoize#resolvers

Let me know if you feel it could be better.