redis-go-cluster Go 实现的 Redis 集群客户端 项目简介
redis-go-cluster 是基于 Redigo 实现的 Golang Redis 客户端。redis-go-cluster 可以在本地缓存 slot 信息,并且当集群修改的时候会自动更新。此客户端管理每个节点连接池,使用 goroutine 来尽可能的并发执行,达到了高效,低延迟。redis-go-cluster 支持:Most commands of keys, strings, lists, sets, sorted sets, hashes.MGET/MSETPipelining不支持:Cluster commandsPub/SubTransactionLua script使用import "github.com/chasex/redis-go-cluster"
cluster, err := redis.NewCluster(
&redis.Options{
StartNodes: []string{"127.0.0.1:7000", "127.0.0.1:7001", "127.0.0.1:7002"},
ConnTimeout: 50 * time.Millisecond,
ReadTimeout: 50 * time.Millisecond,
WriteTimeout: 50 * time.Millisecond,
KeepAlive: 16,
AliveTime: 60 * time.Second,
})
cluster, err := redis.NewCluster(
&redis.Options{
StartNodes: []string{"127.0.0.1:7000", "127.0.0.1:7001", "127.0.0.1:7002"},
ConnTimeout: 50 * time.Millisecond,
ReadTimeout: 50 * time.Millisecond,
WriteTimeout: 50 * time.Millisecond,
KeepAlive: 16,
AliveTime: 60 * time.Second,
})