我在router里面下了如下的代码:
var redis = require('redis');
console.log(process.env.REDIS_URL_cache1);
var redisClient = redis.createClient(process.env.REDIS_URL_cache1, {connect_timeout:1});
redisClient.on('error',function(error){
console.log(error);
});
redisClient.on('connect', function() {
console.log('connected');
});
redisClient.on('end', function(){
console.log("connected end");
});
我在本地运行的时候,可以看到
undefined
Node app is running, port: 3000
connected
redis成功的连接上
然而,在webhost 的测试环境下运行的时候,会发现,这块的日志都不见了
然而在我使用set和get的时候,会报错:
INFO 2015-11-14 20:40:47 { [Error: SET can't be processed. The connection has already been closed.] command: 'SET' }
INFO 2015-11-14 20:40:47 { [Error: EXPIRE can't be processed. The connection has already been closed.] command: 'EXPIRE' }
请帮忙看下