Hello,
I'm looking for clarification on how to set cache max size. In this example:
var LRU = require("lru-cache")
, options = { max: 500
, length: function (n) { return n * 2 }
, dispose: function (key, n) { n.close() }
, maxAge: 1000 * 60 * 60 }
, cache = LRU(options)
, otherCache = LRU(50) // sets just the max size
What value does 'length' function operate on? Is n related to key or value
stored in cache?
I store documents of an average size of 1.5 kB in cache. Key is an MD5 hash
(constant length).
Since I know average document size can I return 1 as length function
output, and treat max as document count?
I.e. if max = 500 then it's an indicator of 500 documents, each of size 1.5
kB (750 kB total)?
Thanks,
M
--
Job board: http://jobs.nodejs.org/
New group rules:
https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules:
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 unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/nodejs/e338a57f-235a-4421-ab46-e3da7f38fade%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.