Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tirithen/promised-cache
Node.js object cache that uses file system for persistence
https://github.com/tirithen/promised-cache
Last synced: about 5 hours ago
JSON representation
Node.js object cache that uses file system for persistence
- Host: GitHub
- URL: https://github.com/tirithen/promised-cache
- Owner: tirithen
- License: gpl-3.0
- Created: 2016-09-15T23:51:54.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2018-11-08T22:24:29.000Z (about 6 years ago)
- Last Synced: 2024-04-26T04:21:37.063Z (7 months ago)
- Language: JavaScript
- Size: 24.4 KB
- Stars: 0
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[![Build Status](https://travis-ci.org/tirithen/promised-cache.svg?branch=master)](https://travis-ci.org/tirithen/promised-cache)
# 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'}}
});