From 2b64f3d0b2d3fb1f09c1a417f638c9bdabda689d Mon Sep 17 00:00:00 2001 From: Gregor MacLennan Date: Sun, 29 Mar 2015 13:38:39 -0700 Subject: [PATCH] Pass dispose, length & stale options to lru-cache The length option is particularly useful with lru-cache if you want to store large objects of varying size and limit memory usage. https://github.com/isaacs/node-lru-cache#options --- lib/stores/memory.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/stores/memory.js b/lib/stores/memory.js index bcd9730..defa2ea 100644 --- a/lib/stores/memory.js +++ b/lib/stores/memory.js @@ -7,7 +7,10 @@ var memoryStore = function(args) { var ttl = args.ttl; var lruOpts = { max: args.max || 500, - maxAge: ttl ? ttl * 1000 : null + maxAge: ttl ? ttl * 1000 : null, + dispose: args.dispose, + length: args.length, + stale: args.stale }; var lruCache = new Lru(lruOpts);