File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -259,12 +259,16 @@ var (
259
259
// NewUniversalClient returns a new multi client. The type of the returned client depends
260
260
// on the following conditions:
261
261
//
262
- // 1. If the MasterName option is specified, a sentinel-backed FailoverClient is returned.
263
- // 2. if the number of Addrs is two or more, a ClusterClient is returned.
264
- // 3. Otherwise, a single-node Client is returned.
262
+ // 1. If the MasterName option is specified with RouteByLatency, RouteRandomly or IsClusterMode,
263
+ // a FailoverClusterClient is returned.
264
+ // 2. If the MasterName option is specified without RouteByLatency, RouteRandomly or IsClusterMode,
265
+ // a sentinel-backed FailoverClient is returned.
266
+ // 3. If the number of Addrs is two or more, or IsClusterMode option is specified,
267
+ // a ClusterClient is returned.
268
+ // 4. Otherwise, a single-node Client is returned.
265
269
func NewUniversalClient (opts * UniversalOptions ) UniversalClient {
266
270
switch {
267
- case opts .MasterName != "" && (opts .RouteByLatency || opts .RouteRandomly ):
271
+ case opts .MasterName != "" && (opts .RouteByLatency || opts .RouteRandomly || opts . IsClusterMode ):
268
272
return NewFailoverClusterClient (opts .Failover ())
269
273
case opts .MasterName != "" :
270
274
return NewFailoverClient (opts .Failover ())
You can’t perform that action at this time.
0 commit comments