30 lines
554 B
JavaScript
30 lines
554 B
JavaScript
|
var moment = require("moment");
|
||
|
var redis = require("redis");
|
||
|
var redisClient = redis.createClient();
|
||
|
|
||
|
redisClient.on("connect", function () {
|
||
|
console.log("connected to redis");
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
redisClient.zrangebyscore('onlinecount', "-inf", "+inf", function(err, replies) {
|
||
|
|
||
|
var data = [];
|
||
|
|
||
|
replies.forEach(function (reply, i) {
|
||
|
|
||
|
var line = reply.split('|');
|
||
|
data.push( { at: moment(parseInt(line[0])).format(), value: line[1] });
|
||
|
|
||
|
|
||
|
});
|
||
|
|
||
|
console.log(data);
|
||
|
|
||
|
redisClient.quit();
|
||
|
});
|
||
|
|
||
|
|
||
|
});
|