Jeff, sorry for delayed response, I wanted to take some time and look into LRU case. Indeed it's much more useful approach than FIFO, I changed internal algorithm for max option to use that instead: https://github.com/medikoo/memoize/blob/master/lib/ext/max.js so now it's definitely backed by LRU.
I've also improved modularization, so other algorithms if needed can be easily configured. New browser bundle can be found in downloads section, if you want you can (using webmake) create bundle trimmed of functionalities you don't need - see lib/index.js how it's done, one that I've uploaded provides everything. Mariusz On Wednesday, September 19, 2012 9:36:38 PM UTC+2, Jeff Barczewski wrote: > > Mariusz, > > You are right, I missed the mention in the readme about building it for > the browser, but it is nice that you prepared a download bundle. Honestly I > just went right to the code first and only glanced at the README for the > API, so I ended up missing that. > > Correct me if I am wrong, but isn't the max option, FIFO, so unlike a LRU > cache which keeps the most recently used objects cached, this would expire > the first one that was cached regardless of whether it was recently > used/requested or not. > > One reason this is nice is that a LRU cache ends up staying loaded with > the most popular content, the random requests don't end up kicking out an > important one. > > For many things, the max option would be fine, but just for completeness > (and a very popular use case), it would be great to have a LRU option. > > Just my thoughts for completing out the feature set. I think your project > is great none the less. > > Jeff > > > > On Wednesday, 19 September 2012 10:47:07 UTC-5, Mariusz Nowak wrote: >> >> Jeff, >> >> It can easily be ported to browser with help of Webmake >> https://github.com/medikoo/modules-webmake (it's mentioned in >> documentation) >> Anyway to make it even easier I prepared a bundle -> >> https://github.com/medikoo/memoize/downloads ;) >> >> According to LRU option, you can achieve it with 'max' option -> >> https://github.com/medikoo/memoize#limiting-cache-size >> See also 'maxAge' and 'dispose' options. Is that what you're after? >> >> >> On Wednesday, September 19, 2012 5:17:58 PM UTC+2, Jeff Barczewski wrote: >>> >>> Mariusz, >>> >>> I took a closer look and realized that there a many dependencies (I was >>> thinking it was self contained), so not as simple to get into the browser, >>> either need to use something like AMD or build a distribution file with one >>> of the commonsjs browser build solutions. >>> >>> Jeff >>> >>> >>> >>> On Wednesday, 19 September 2012 10:14:57 UTC-5, Jeff Barczewski wrote: >>>> >>>> Mariusz, >>>> >>>> memoize looks really nice! I am going to try it out for some projects I >>>> am working on. >>>> >>>> As for suggestions: >>>> >>>> - you might consider wrapping the file in a function closure so it can >>>> be used directly in a browser >>>> - could you add a LRU option? (I know you have many other algorithms, >>>> but would be nice to have if it doesn't add too much bulk) >>>> >>>> Thanks for sharing this! >>>> >>>> All the best, >>>> >>>> Jeff >>>> >>> -- 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
