1
0
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:
Vladimir Mihailenco
2014-07-13 15:49:33 +03:00
parent 2651b57a91
commit ffe62d60e2
5 changed files with 25 additions and 5 deletions

View File

@ -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)