windchime
windchime

Reputation: 1285

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

In Redis cluster tutorial, it is stated that

"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."

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

Upvotes: 2

Views: 1250

Answers (1)

luin
luin

Reputation: 1995

Yes, ioredis caches the slots for you and handles the moved and ask error to update the slot cache.

The related code is here:

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

Upvotes: 3

Related Questions