Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

cachish

vinniegarcia9MIT1.0.0

A simple name/value expiring evented cache

cache, expire, timeout, evented

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 a Promise for the value of key in cache
  • add(key, value) - adds to the cache asynchronously
  • update(key, value) - updates key in the cache
  • delete(key) - removes key 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