expeditious-engine-memory
An in memory engine for expeditious. Cache entries are - you guessed it - stored in the node.js process memory. This cache engine will lose everything stored if your process restarts, and could lead to memory bloat and slow garbage collections if you're not careful with the size and volume of entries!
Usage
You can use this module standalone or with expeditious which is the recommended approach since it simplifies interactions and allows you to easily switch cache engines.var expeditious = require('expeditious');
var countries = expeditious({
// Use the expeditious memory engine
engine: require('expeditious-engine-memory')(),
// Prefix all entries with 'countries'
namespace: 'countries',
// Auto parse json entries
objectMode: true,
// 1 hour timeout for entries
defaultTtl: (60 * 1000 * 60),
});
countries.set({
key: 'ireland',
value: {
population: '4.595 million',
capital: 'Dublin'
}
}, function (err) {
if (!err) {
console.error('failed to add "ireland" to the cache');
} else {
console.log('add "ireland" to the cache');
}
});