Skip to content


`load()` methods #18

mikeal opened this Issue · 5 comments

4 participants


We have .dump() and .dumpLRU, would be nice if you could do something like.

var lru = require('lru-cache').load(JSON.parse(fs.readFileSync('./dump.json').toString()))

Maybe a matching one for loadLRU.


Yes, that'd be nice.


I looked into this a tiny bit, and it's surprisingly tricky to get right. You have to serialize not just the cache entries and lru list, but all the counters and whatnot as well.


This would be very useful, making lru persistant in disk.


It seems useful on the surface, but it's probably not really all THAT useful, because if you need/want it to persist to disk, then another tool is probably better suited. Something like MemcacheDB or Redis.


This was added in #40.

@isaacs isaacs closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.