cachish
v1.0.0
Published
A simple name/value expiring evented cache
Downloads
1
Maintainers
Readme
cachish
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 cacheadd(key, value)
- adds to the cache asynchronouslyupdate(key, value)
- updateskey
in the cachedelete(key)
- removeskey
and its value from the cacheclear()
- empties cache
##Events
add
- occurs when an item is addedupdate
- occurs when an item is updateddelete
- happens when an item is deletedempty
- occurs when cache is cleared
##Questions/comments
File an issue