memories.js
A simple in-memory cache module for node.js
Installation
Installing npm (node package manager)
curl http://npmjs.org/install.sh | sh
Installing memories
[sudo] npm install memories.js
Usage
var cache = require('./lib/memories');
// add new item to the cache
cache.put('cat', 'schroedingers');
cache.get('cat'); // schroedingers
// check cache length
cache.size(); // 1
// delete item from cache
cache.del('cat'); // gone
API
put()
cache.put: function(key, value, time)
@param key {String} an Id.
@param value {String} || {Object} a String or JSON object.
@param time {integer} [optional] time after the Item will be removed from cache.
get()
cache.get: function(key)
@param key {String} an Id.
del()
cache.del: function(key)
@param key {String} an Id.
size()
cache.size: function()
Run Tests
Tests are written in vows.
$ npm test