1.0.0 • Published 7 years ago
@ahmadnassri/simple-file-cache v1.0.0
Simple File Cache
a simple and easy to use file-based cache
Install
npm install @ahmadnassri/simple-file-cacheAPI
_(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
1.0.0
7 years ago