memory-cache-ttl   
A simple (and performant) in-memory cache with Time To Live functionality.
Install
npm i memory-cache-ttl --save
Usage
``javascript
const cache = require('memory-cache-ttl');
cache.init({ ttl: 3, interval: 1, randomize: false });
cache.set('asd', 'dsa');
console.log(cache.check('asd')); //true
console.log(cache.get('asd')); //dsa
setTimeout(() => {
console.log(cache.check('asd')); //false
console.log(cache.get('asd')); //undefined
}, 5000);
``
API
$3
sets global options
$3
sets value and local TTL (seconds) for key.
$3
returns true/false
$3
returns value of key
$3
deletes value of key
$3
deletes all values
Settings
$3
sets a global TTL
$3
sets TTL expiery-check interval
$3
randomizes the TTL (needs global TTL to be set)
$3
resets the TTL on a cache entry hit with .get()
$3
a promise called on each interval, takes cache entry id as a parameter and can (optional) return a new cache entry value.
if no value is returned, the old cache value is used.