Skip to content

tj/node-redis-histogram

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

redis-histogram

Redis histogram for node.js

Installation

$ npm install redis-histogram

Example

var Histogram = require('..');
var redis = require('redis');

var hist = new Histogram({
  client: redis.createClient(),
  bins: 10
});

var n = 1000;

while (n--) {
  hist.add(Math.random() * 50 | 0);
}

hist.load(function(err, res){
  console.log(res)
});

API

Histogram(options)

  • client redis client
  • key redis key ["histogram"]
  • bins number of bins [1000]

Histogram#add(value, [fn])

Bin value with optional callback.

Histogram#load(fn)

Load histogram bins.

License

MIT

About

Redis histograms for nodejs

Resources

Stars

Watchers

Forks

Packages

No packages published