A simple Redis Cache using node-redis
var Cache = require('cacheit');
var cache = new Cache();key- stringvalue- string or hash object (must be flat)ttl- time to live in mcallback
An alias for cache.set. This is just for symmetry with cache.getHash.
key - string
Returns the string value or 'undefined' if the key is not found.
key - string
Returns the entire hash object using the redis 'HGETALL' command.
key - string
Deletes the key using the redis 'DEL' command.
Returns the total number of keys currently cached
cache.client- access the raw redis clientcache.hitscache.missescache.errorscache.default_ttlcache.connectscache.disconnectscache.connected
Ensure you have a local version of redis running.
Install mocha
npm install mocha
Run tests
cd test
mocha test.js --reporter spec