【问题标题】:node.js and redis : is a redis store accessible across node connections?node.js 和 redis:是否可以跨节点连接访问 redis 存储?
【发布时间】:2013-08-17 02:59:40
【问题描述】:

一个非常基本的问题,但我在任何地方都找不到答案(可能是因为它太明显了):

在 node.js(即“redis”npm 模块)中,redis 存储是否像其他数据库一样可以跨 node.js 连接访问?

假设我这样设置我的 node.js 服务器

var redis = require("redis"),
    client = redis.createClient();

假设我有两个独立的连接:用户 A 和用户 B。如果用户 A 有

client.set("foo", "bar", redis.print);

而用户 B(在不同的节点连接上)会这样做

client.get("foo", function (err, reply) {
    console.log(reply.toString());
});

用户 B 会得到未定义还是会得到 'bar'?

【问题讨论】:

    标签: node.js redis node-redis


    【解决方案1】:

    只要它们以正确的顺序运行就是真的。

    【讨论】:

      猜你喜欢
      • 2017-02-15
      • 2015-09-01
      • 2021-11-01
      • 2017-08-06
      • 2014-03-25
      • 1970-01-01
      • 2021-01-01
      • 2022-06-14
      • 2018-10-26
      相关资源
      最近更新 更多