@@ -53,6 +53,7 @@ type UniversalOptions struct {
53
53
54
54
// The sentinel master name.
55
55
// Only failover clients.
56
+
56
57
MasterName string
57
58
}
58
59
@@ -168,9 +169,9 @@ func (o *UniversalOptions) Simple() *Options {
168
169
// --------------------------------------------------------------------
169
170
170
171
// UniversalClient is an abstract client which - based on the provided options -
171
- // can connect to either clusters , or sentinel-backed failover instances
172
- // or simple single-instance servers. This can be useful for testing
173
- // cluster-specific applications locally .
172
+ // represents either a ClusterClient, a FailoverClient , or a single-node Client.
173
+ // This can be useful for testing cluster-specific applications locally or having different
174
+ // clients in different environments .
174
175
type UniversalClient interface {
175
176
Cmdable
176
177
Context () context.Context
@@ -190,12 +191,12 @@ var (
190
191
_ UniversalClient = (* Ring )(nil )
191
192
)
192
193
193
- // NewUniversalClient returns a new multi client. The type of client returned depends
194
- // on the following three conditions:
194
+ // NewUniversalClient returns a new multi client. The type of the returned client depends
195
+ // on the following conditions:
195
196
//
196
- // 1. if a MasterName is passed a sentinel-backed FailoverClient will be returned
197
- // 2. if the number of Addrs is two or more, a ClusterClient will be returned
198
- // 3. otherwise , a single-node redis Client will be returned.
197
+ // 1. If the MasterName option is specified, a sentinel-backed FailoverClient is returned.
198
+ // 2. if the number of Addrs is two or more, a ClusterClient is returned.
199
+ // 3. Otherwise , a single-node Client is returned.
199
200
func NewUniversalClient (opts * UniversalOptions ) UniversalClient {
200
201
if opts .MasterName != "" {
201
202
return NewFailoverClient (opts .Failover ())
0 commit comments