Skip to content

Loading…

`load()` methods #18

Closed
mikeal opened this Issue · 5 comments

4 participants

@mikeal

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.

@isaacs
Owner

Yes, that'd be nice.

@isaacs
Owner

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.

@satazor

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

@johann8384

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.

@isaacs
Owner

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.