只能靠超时来判断。
参考代码
var redispool = poolModule.Pool({
name : 'redis',
create : function(callback) {
var client = Redis.createClient(configs.dbconfig.dbredis.port,
configs.dbconfig.dbredis.host);
// client.connect();
callback(null, client);
},
destroy : function(client) { client.quit(); },
max : 10,
// optional. if you set this, make sure to drain() (see step 3)
min : 2,
// specifies how long a resource can stay idle in pool before being removed
idleTimeoutMillis : 30000
// if true, logs via console.log - can also be a function
//log : true
});
function getRedisClient() {
return redispool.acquireAsync().disposer(function(client, promise) {
console.log("redispool.release(client)")
redispool.release(client);
});
}
dbs.redisclient = getRedisClient ;
--------------
检测redisclient是否为空