promised-cache

Node.js object cache that uses file system for persistence

Usage no npm install needed!

<script type="module">
  import promisedCache from 'https://cdn.skypack.dev/promised-cache';
</script>

README

Build Status

promised-cache

A cache meant for Node.js that stores in memory and to disk with a timeout. Each method returns a promise. Keys can be any type string/number/array/object as their hashes will be used internally.

Install

$ npm install promised-cache --save

Example use

const Cache = require('promised-cache');

const cache = new Cache('cahename', 3600 * 1000);

cache.set('a key', {some: {data: 'to store'}});

cache.get('a key').then((cachedData) => {
  console.log(cachedData); // Prints {some: {data: 'to store'}}
});