fs-cash đź’°
A simple fs-persisted json cache.
Quick start
npm install --save fs-cash
const cache = require('fs-cash');
cache.set('key', 'value').then(() => {
});
Everything is persisted to process.cwd() / .cash
cache.get('key').then((value) => {
});
API
del( key:string ) :Promise
Delete cached value.
get( key:string ) :Promise<*>
Get cached value.
memoize( func:function [, serialize:function ] ) :function
Memoize a function.
const sqrt = cache.memoize(Math.sqrt);
sqrt(16).then((value) => { });
set( key:string, value:* [, options:object] ) :Promise
Set cached value.
options.ttl :number
Cached value will expire after ttl (time to live) milliseconds.
reset( key:string ) :Promise
Reset cache and delete cache file.