A simple name/value expiring evented asynchronous cache
##Usage
var Cachish = require('cachish')
var cache = new Cachish(300000) //feed a timeout value in msecs, default is 10 minutes
cache.set('itemName', 'hello')
cache.get('itemName').then(function (value) {
console.log(value) //=> hello
})
##API
-
get(key)
- returns aPromise
for the value ofkey
in cache -
add(key, value)
- adds to the cache asynchronously -
update(key, value)
- updateskey
in the cache -
delete(key)
- removeskey
and its value from the cache -
clear()
- empties cache
##Events
-
add
- occurs when an item is added -
update
- occurs when an item is updated -
delete
- happens when an item is deleted -
empty
- occurs when cache is cleared
##Questions/comments
File an issue