mirror of
https://github.com/redis/go-redis.git
synced 2025-06-12 14:21:52 +03:00
Add basic example how to use Redis Cluster. Unify comments.
This commit is contained in:
@ -31,10 +31,22 @@ func ExampleNewClient() {
|
||||
}
|
||||
|
||||
func ExampleNewFailoverClient() {
|
||||
redis.NewFailoverClient(&redis.FailoverOptions{
|
||||
// See http://redis.io/topics/sentinel for instructions how to
|
||||
// setup Redis Sentinel.
|
||||
client := redis.NewFailoverClient(&redis.FailoverOptions{
|
||||
MasterName: "master",
|
||||
SentinelAddrs: []string{":26379"},
|
||||
})
|
||||
client.Ping()
|
||||
}
|
||||
|
||||
func ExampleNewClusterClient() {
|
||||
// See http://redis.io/topics/cluster-tutorial for instructions
|
||||
// how to setup Redis Cluster.
|
||||
client := redis.NewClusterClient(&redis.ClusterOptions{
|
||||
Addrs: []string{":7000", ":7001", ":7002", ":7003", ":7004", ":7005"},
|
||||
})
|
||||
client.Ping()
|
||||
}
|
||||
|
||||
func ExampleClient() {
|
||||
|
Reference in New Issue
Block a user