npm

Need private packages and team management tools?Check out npm Orgs. »

@ahmadnassri/simple-file-cache

1.0.0 • Public • Published

Simple File Cache

License version Build Status

a simple and easy to use file-based cache

Install

npm install @ahmadnassri/simple-file-cache

API

_(namespace)

Create a new cache name space

const simple = require('@ahmadnassri/simple-file-cache')
 
const cache = simple('my-awesome-app')
 
cache.set('foo', 'bar', 100)

set(key, value[, ttl])

Creates a cache record using the key:value pair, and optionally sets an expiry date using ttl in milliseconds.

cache.set('foo', 'bar', 100)

get(key)

retrieves a cache record identified with key, if the expiry time has elapsed, the record will be deleted and return a value of null

cache.get('foo')

process.env.SIMPLE_CACHE_DIR

path to store the cache records, defaults to $XDG_CACHE_HOME


Author: Ahmad Nassri • Github: @ahmadnassri • Twitter: @ahmadnassri

install

npm i @ahmadnassri/simple-file-cache

Downloadsweekly downloads

2

version

1.0.0

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability