Redis 连接池 + Node.js [英] Redis connection pools + Node.js

查看:53
本文介绍了Redis 连接池 + Node.js的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Node.js 异步 I/O 是否需要 Redis 连接池?

Are Redis connection pools necessary with Node.js asynchronous I/O?

我看到的大多数 Redis 库都允许您创建客户端连接,但连接池模块并不多,所以我认为它不那么重要.

Most of the Redis libraries I see allow you to create client connections but there aren't many connection pool modules so I assume it's not as important.

让我困惑的一件事是 Redis 在一个 Redis 实例中默认有 16 个不同/分段的数据库.

The one thing that confuses me is that Redis has a default of 16 different/segmented databases in one Redis instance.

那么如果你创建了一个连接池,你连接到了 16 个数据库中的哪个?您可以使用同一个连接池一次连接到所有 16 个吗?

So if you create a connection pool, which database of the 16 are you connected to? Can you connect to all 16 at once with the same connection pool?

是否有一个 Node.js Redis 库可以创建一个连接池,每个数据库有 1 个客户端,具体取决于您使用的数据库数量?

Is there a Node.js Redis library that creates a connection pool with 1 client per database, depending on how many databases you are using?

推荐答案

您在一个帖子中提出了太多问题.

You've asked too many questions in one post.

试图回答他们;

Node.js 异步 I/O 是否需要 Redis 连接池?

Are Redis connection pools necessary with Node.js asynchronous I/O?

重复的 Node.js Redis 连接池

那么如果你创建了一个连接池,你连接的是 16 个数据库中的哪个?

So if you create a connection pool, which database of the 16 are you connected to?

默认情况下,你总是连接到数据库 0.如果你在想为什么 0,redis 中的数据库是编号的.它们不能重命名为字符串.

By default you're always connected to database 0. Databases in redis are numbered if you're thinking why 0. They cannot be renamed to a string.

你能用同一个连接池同时连接到所有 16 个吗?

Can you connect to all 16 at once with the same connection pool?

不需要连接池

是否有一个 Node.js Redis 库可以创建一个连接池,每个数据库有 1 个客户端,具体取决于您使用的数据库数量?

Is there a Node.js Redis library that creates a connection pool with 1 client per database, depending on how many databases you are using?

搜索后我找到了两个:

这篇关于Redis 连接池 + Node.js的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆