mirror of
https://github.com/redis/go-redis.git
synced 2025-06-12 14:21:52 +03:00
Add example for failover client.
This commit is contained in:
@ -22,7 +22,17 @@ func ExampleNewTCPClient() {
|
||||
Password: "", // no password set
|
||||
DB: 0, // use default DB
|
||||
})
|
||||
defer client.Close()
|
||||
|
||||
pong, err := client.Ping().Result()
|
||||
fmt.Println(pong, err)
|
||||
// Output: PONG <nil>
|
||||
}
|
||||
|
||||
func ExampleNewFailoverClient() {
|
||||
client := redis.NewFailoverClient(&redis.FailoverOptions{
|
||||
MasterName: "master",
|
||||
SentinelAddrs: []string{":26379"},
|
||||
})
|
||||
|
||||
pong, err := client.Ping().Result()
|
||||
fmt.Println(pong, err)
|
||||
|
Reference in New Issue
Block a user