Simple caching for Node. Like, really simple.

npm install simple-cache
2 downloads in the last week
9 downloads in the last month


Super simple key/value storage for NodeJS. Wouldn't say it's production ready at all but if you're working on speeding up a small hack or prototype it's easy to use for caching and similar requirements.


Unless you're getting a lot of concurrent requests, you can safely stick to using Storage.get() and Storage.set() to store and retrieve data.

var Storage = require('simple-cache').Storage;
var cache = new Storage();

if (!cache.exists('hello')) {
    cache.set('hello', world);

cache.get('hello');            //Returns 'world'

But when requests start to pile up, calling this within a non-blocking function such as fs.readFile() means that you could still be calling the function multiple times before it's stored in the cache. In this case, 'Storage.async()' keeps calls in line until the value is set.

var fs = require('fs');
var cache = new (require('simple-cache').Storage)();

fs.readFile('filename', function(err, data) {
    if (cache.exists('hello')) {
    } else {
        cache.set('hello', world);

cache.async('hello', function(setValue) {
    fs.readFile('filename', function(err, data) {
}, function(value) {
npm loves you