2.0.0 • Published 7 years ago

fs-cash v2.0.0

Weekly downloads
-
License
MIT
Repository
-
Last release
7 years ago

Quick start

npm install --save fs-cash
const cache = require('fs-cash');
cache.set('key', 'value').then(() => {
  // saved
});

Everything is persisted to process.cwd() / .cash

cache.get('key').then((value) => {
  // value = key
});

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) => { /* 4 */ });

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.

2.0.0

7 years ago

1.1.1

7 years ago

1.1.0

7 years ago

1.0.0

7 years ago