@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

Dependents (0)

Package Sidebar

Install

npm i @ahmadnassri/simple-file-cache

Weekly Downloads

1

Version

1.0.0

License

MIT

Unpacked Size

5.29 kB

Total Files

5

Last publish

Collaborators

  • ahmadnassri