Vitaly, Most cases I've approached with memoize was to provide value *on demand*, so not to generate additional work if there's no need to. If it expires it's vanished, maybe it won't be needed again, leave it the way it is. Anyway I can imagine cases where behavior you describe can be desirable, so it`s probably worthwhile extension (and quite easy to add), I've added issue https://github.com/medikoo/memoize/issues/1, so it'll soon be possible. Thanks! :)
On Monday, September 24, 2012 12:45:48 AM UTC+2, Vitaly Puzrin wrote: > > Mariusz, > > Thanks for sharing memoizee. > > I have comment about timeouts. Very often, it's recommended to use > "replace" strategy, instead of "delete". I mean, > if data is expired, you still continue to return old data from cache, but > fetch new one in background. It can be easily implemented > in async mode. That has 2 benefits: > - no freezes on expires > - easy to avoid parallel refresh requests > > Vitaly. > > среда, 19 сентября 2012 г., 2:06:21 UTC+4 пользователь Mariusz Nowak > написал: >> >> https://github.com/medikoo/memoize >> >> npm install memoizee >> >> For one of my projects I needed memoizer, that would be both fast and >> would work with any type of input arguments. Other projects demanded other >> common functionalities, so it's result of real world needs I approached in >> last months. To make it complete in latest stage I added max and maxAge >> options (lru-cache inspiration) >> >> Features in short: >> - Works with any type of function arguments - no serialization is needed >> - Works with any length of function arguments. Length can be set as fixed >> or dynamic. >> - One of the fastest available solutions (when talking about plain simple >> case it's slightly slower than basic underscore implementation and about 3 >> x faster than lru-cache) >> - Support for asynchronous functions >> - Optional primitive mode which assures fast performance when arguments >> are conversible to strings. >> - Can be configured for methods (when `this` counts in) >> - Cache can be cleared manually or after specified timeout >> - Cache size can be limited >> - Optionally accepts resolvers that normalize function arguments before >> passing them to underlying function. >> - Optional reference counter mode, that allows more sophisticated cache >> management >> - Profile tool that provides valuable usage statistics >> - Covered by over 500 unit tests >> >> I use it all over the place now. Let me know what you think, any feedback >> highly welcome >> > -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups "nodejs" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en
