ufk*_*ufk 3 redis node.js ioredis
我正在编写nodejs 5.10.1应用程序,并且我连接到redis-server.
我正在使用https://github.com/luin/ioredis上的ioredis nodejs模块.
我似乎无法弄清楚如何检查是否建立了与服务器的连接.
连接到redis服务器的代码非常简单:
var Redis = require('ioredis');
var redis = new Redis();
Run Code Online (Sandbox Code Playgroud)
文档在连接事件下声明以下内容
You can also check out the Redis#status property to get the current connection status.
Run Code Online (Sandbox Code Playgroud)
不明白它意味着什么或如何使用它.有任何想法吗 ?
您启动的redis对象的一个属性是status:
console.log(redis.status) 会给你当前的,在我看来它说: connecting