1.0.0 • Published 6 years ago
hs-cache v1.0.0
hs-cache
A simple Node.js cache library.
Install
npm install hawooni/hs-cacheInitialize
const Cache = require('hs-cache');
const cache = new Cache(10000); // cache only 10 secondsconst cache = new Cache(0); // cache does not expireCache to file
By default cache is stored in memory until the program ends.
cache.dir = './cache/folder';Store a key value
cache.set('test1', 'this is test one');Retrieve a key
If data is expired, the function will return null.
var data = cache.get('test1');Retrieve last stored Date
var storedAt = cache.updatedAt('test1');1.0.0
6 years ago