node.js - 与 radislabs memcached 云的紧密连接

标签 node.js redis

我使用 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/

相关文章:

redis - 错误 : invalid token 'verify' after the command "rladmin help verify "

java - 如何增加 redis 排序集的值

javascript - 如何使用 MongoDB native Node.js 驱动程序运行 db.killOp()?

variables - 脚本试图创建全局变量

javascript - react /nextJS : How to debug different nodes of SSR react application?

node.js - 有没有办法在 Node.Js 中进行阻塞调用?

performance - redis 使用什么传输方式发送接收消息

java - JedisCluster 在 2.7.x 中工作,但在 Jedis 2.9.x 中不工作,JedisConnectionException 和 Connection refused

mysql - Sequelize 如何比较日期的年份和月份

javascript - 将数组添加到javascript中的对象数组