Although hiredis-cluster is mainly for Redis Cluster, it is useful to also support Redis standalone instances. The benefit is that the same client and application code can be used regardless of the Redis configuration.
[ ] When connecting, we send a CLUSTER SLOTS command to figure out the slot mapping. If Redis replies with an error indicating that it's not in cluster mode, we can handle this implicitly and return a success code to the caller.
[ ] When updating the slot mapping, if we know that we're in standalone mode, there is no point sending the CLUSTER SLOTS command to Redis. It also does no harm doing so, but it's an extra call to Redis, so this bullet point is not of the highest priority.
[ ] We could allow a standalone option when connecting to the cluster, which is just an indication meaning that we guess that we're not in cluster mode. CLUSTER SLOTS is not sent when connecting, but if we later receive a MOVED redirect, the slot mapping is fetched and we switch to cluster mode. The default should be cluster mode though, since this is primarily a cluster client.
Although hiredis-cluster is mainly for Redis Cluster, it is useful to also support Redis standalone instances. The benefit is that the same client and application code can be used regardless of the Redis configuration.
standalone
option when connecting to the cluster, which is just an indication meaning that we guess that we're not in cluster mode. CLUSTER SLOTS is not sent when connecting, but if we later receive a MOVED redirect, the slot mapping is fetched and we switch to cluster mode. The default should be cluster mode though, since this is primarily a cluster client.