A simple memory cache for Node

npm install kache
4 downloads in the last week
8 downloads in the last month


A Simple memory cache for Node.js.

More info coming soon.


$ npm install kache

Example Usage

// Include the module
var kache = require('kache');

// Set some options - these are the defaults
var options = {
    start: true     // Start a timer to remove old cache entries.
  , interval: 300   // Time in seconds between each scan.

// Create a new cache
var cache = kache(options);

// Set 'hello' to 'hello world' - expires in 3 seconds
cache.set('hello', 'hello world', 3);

// Get 'hello' from the cache and log to console
console.log(cache.get('hello')); // Outputs: 'hello world'

// Wait 5 seconds and try again. The item will have expired and is no longer available.
setTimeout(function() {
  console.log(cache.get('hello')); // null
}, 5000);


This is very much a work in progress, there may be bugs and you can probably expect some API changes!


  • Maximum Cache Size: Delete old items from the cache when the cache is full.
  • LRU: Implement a Least Recently Used Mode
npm loves you