Redis Universal client
TIP
To get an idea how to use go-redis client, see Getting started guide.
UniversalClient is a wrapper client which, based on the provided options, represents either a ClusterClient, a FailoverClient, or a single-node Client. This can be useful for testing cluster-specific applications locally or having different clients in different environments.
NewUniversalClient returns a new multi client. The type of the returned client depends on the following conditions:
- If the 
MasterNameoption is specified, a sentinel-backedFailoverClientis returned. - if the number of 
Addrsis two or more, aClusterClientis returned. - Otherwise, a single-node 
Clientis returned. 
For example:
// rdb is *redis.Client.
rdb := NewUniversalClient(&redis.UniversalOptions{
    Addrs: []string{":6379"},
})
// rdb is *redis.ClusterClient.
rdb := NewUniversalClient(&redis.UniversalOptions{
    Addrs: []string{":6379", ":6380"},
})
// rdb is *redis.FailoverClient.
rdb := NewUniversalClient(&redis.UniversalOptions{
    Addrs: []string{":6379"},
    MasterName: "mymaster",
})