我使用 Node 模块 memjs与 redis 实验室 memcached 云。有没有办法关闭连接?谢谢。
最佳答案
在github.com/alevy/memjs/blob/master/lib/memjs/memjs.js
有一种方法可以遍历连接的服务器并关闭每个服务器的连接。另一种方法是 quit
,它实际上使用了 close
。
// Closes (abruptly) connections to all the servers.
Client.prototype.close = function() {
for (var i in this.servers) {
this.servers[i].close();
}
}
如 RedisLabs 的文档所示,创建客户端 here
var memjs = require('memjs');
var mc = memjs.Client.create('hostname:port', {
username: 'username',
password: 'password'
});
将为您提供执行以下操作以关闭的选项:
mc.close();
关于node.js - 与 radislabs memcached 云的紧密连接,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33244459/