🚀 DAY 5 OF LAUNCH WEEK: Introducing Socket Firewall Enterprise.Learn more →
Socket
Book a DemoInstallSign in
Socket

fs-cash

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fs-cash

A simple fs-persisted json cache.

latest
npmnpm
Version
2.0.0
Version published
Maintainers
1
Created
Source

fs-cash đź’°

A simple fs-persisted json cache.

npm version Build Status Coverage Status dependencies Status

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.

Keywords

cache

FAQs

Package last updated on 10 Oct 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts