im-cache

Simple in-memory cache for node.js

im-node

im-node is a simple in-memory object cache.

npm install im-node

var cache = require('im-cache');
//Cache {data: true} for one hour with key "key"
cache.set("key", {data: true}, 1000*60*60)
//Cache {data: true} forever with key "key"
cache.set("key", {data: true})
// Set data:
cache.set("key", {data: true}, 10000)
// Equals {data: true}:
cache.get("key");
// Set data:
cache.set("key", {data: true}, 10000)
// Equals {data: true}:
cache.remove("key");
// Equals undefined:
cache.get("key");

Returns cache size

Empties cache