lru-diskcache
A disk cache object that deletes the least-recently-used items. Based on lru-cache.
Usage
var LRU = require("lru-diskcache")
var cache = LRU('./cache', {
max: 50
});
cache.init()
cache.set("myfile.md", "A string content")
cache.get("file").then(function() { ... })
cache.set("image.png", new Buffer([ ... ]))
cache.set("index.html", request.get("https://www.google.fr"))
cache.reset()
If you put more stuff in it, then items will fall out.
If you try to put an oversized thing in it, then it'll fall out right away.
API
cache.init()
cache.get(key)
cache.get(key, { encoding: 'utf8' })
cache.getStream(key)
cache.has(key)
cache.del(key)
cache.size()
cache.prune()