{"size": 1011, "ext": "js", "max_stars_repo_path": "back/dawan/common/db/redis.js", "max_stars_repo_name": "xunull/noadmin-koa", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "back/dawan/common/db/redis.js", "max_issues_repo_name": "xunull/noadmin-koa", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "back/dawan/common/db/redis.js", "max_forks_repo_name": "xunull/noadmin-koa", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 18.0535714286, "max_line_length": 63, "alphanum_fraction": 0.6567754698}
var redis = require('redis'),
	redis_port = 12312,
	redis_host = "127.0.0.1",
	redis_opts = {},
	redis_password=123456,
	client = redis.createClient(redis_port,redis_host,redis_opts);

var logger = global.dawan.logger;

client.auth(redis_password,function(){
  logger.debug('redis 登录成功');
});

client.on('ready',function(){
	logger.debug('redis ready');
});

client.on('connect',function(){

});

client.on('reconnecting',function(){

});

client.on('error',function(){
	logger.info('redis 发生了错误');
});

client.on('end',function(){

});

exports.hgetall = function(key,func) {
	client.hgetall(key,function(err,obj){
		console.log('--------------');
		console.log('redis hgetall is :');
		console.log(key);
		console.log(obj);
		console.log('--------------');
		func(obj);
	});
};

exports.hdel = function(hashkey,key,func) {
	client.hdel(hashkey,key);
};

exports.hset = function(hashkey,key,value,func) {
	client.hset(hashkey,key,value,func);
};

exports.hmset = function(key,obj) {
	client.hmset(key,obj);
};
