ioredis 客户端是否缓存哈希槽和节点地址之间的映射?

Does ioredis client cache the map between hash slots and nodes addresses?

在Redis集群教程中,是这样写的

"A serious client is able to do better than that, and cache the map between hash slots and nodes addresses, to directly use the right connection to the right node. The map is refreshed only when something changed in the cluster configuration, for example after a failover or after the system administrator changed the cluster layout by adding or removing nodes."

ioredis 是否缓存哈希槽和节点地址之间的映射?

是的,ioredis 会为您缓存插槽并处理 movedask 错误以更新插槽缓存。

相关代码在这里:

https://github.com/luin/ioredis/blob/master/lib/cluster/index.js#L387-L398