lru-cache-fs
v2.0.1
Published
Extends lru-cache to add file system support
Downloads
21,403
Readme
lru-cache-fs
Extends lru-cache to add file system support.
Install
npm install lru-cache-fs
Usage
Retrieve cache:
const Cache = require('lru-cache-fs')
const cache = new Cache({
max: 100,
cacheName: "cache" // filename ref to be used
});
By default it will use os specific paths, using env-paths.
Then retrieve/set items using:
cache.get('some-item') // returns whatever was stored
cache.set('some-new-item', 'foo') // sets new item and stores cache sync to fs
The fsDump()
method exposes an API that allows you to persist the current cache on your file system:
cache.fsDump()
All other methods from lru-cache should be available, e.g:
cache.dump() // retrieves dump of current cache memory
License
MIT © 2019 Ruy Adorno