首页 > Web开发 > 详细

nodejs总结之redis模块

时间:2017-06-29 14:52:53      阅读:216      评论:0      收藏:0      [点我收藏+]
 1 //创建redis连接服务对象
 2 var redis = require(‘redis‘);
 3 
 4 var redisServerIP = ‘127.0.0.1‘;
 5 var redisServerPort= ‘6379‘;
 6 
 7 function setup_redis() {
 8     var client = redis.createClient(redisServerPort, redisServerIP);
 9     client.on(‘error‘, function(error) {
10         console.log("RedisServer is error!\n" + error);
11     });
12     client.on("connect", function() {
13         console.log("RedisServer is connected!");
14     });
15     client.on("end", function() {
16         console.log("RedisServer is end!");
17     });
18     return client;
19 }
20 
21 module.exports.setup_redis = setup_redis;

 

nodejs总结之redis模块

原文:http://www.cnblogs.com/atp-sir/p/7094275.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!