redis-hash

Convenience wrapper for Redis hashes

redis-hash-js

This module provides RedisHash, a class that adds some basic syntactic sugar around Redis hash commands like HMGET, HMSET, HINCRBY, among others. Supported operations include:

  • Bulk setting and getting
  • Boolean flags
  • Counters
redis = require('redis');
RedisHash = require('redis-hash-js');
 
hash = new RedisHash(redis.createClient(), 'hashKey');
 
hash.set('x', 'y');
hash.get('x', function(errresult) {
  console.log("x is " + result);
});
 
hash.set({
  a: '1',
  b: '2'
});
 
hash.get(function(errresult) {
  for (in result) {
    console.log(+ "" + result[k]);
  }
});
npm install redis-hash
  • opts
    • emitErrs (true) Redis errors will be emitted as error events