MM们
我想用NewClusterClient, 来回答你的问题我想使用仅连接到集群的一个端点的客户端,并且该端点将确保我获取或设置 redis 的密钥请确保所有这些参数都是false ReadOnly: false, RouteRandomly: false, RouteByLatency: false,示例代码import ( goredis "github.com/go-redis/redis/v8")goredis.NewClusterClient(&goredis.ClusterOptions{ Addrs: []string{"cluster-configuration-endpoint:6379"}, Password: "password", PoolSize: 10, MinIdleConns: 10, DialTimeout: 5 * time.Second, ReadTimeout: 3 * time.Second, WriteTimeout: 3 * time.Second, PoolTimeout: 4 * time.Second, IdleCheckFrequency: 60 * time.Second, IdleTimeout: 5 * time.Minute, MaxConnAge: 0 * time.Second, MaxRetries: 10, MinRetryBackoff: 8 * time.Millisecond, MaxRetryBackoff: 512 * time.Millisecond, TLSConfig: &tls.Config{ InsecureSkipVerify: true, }, ReadOnly: false, RouteRandomly: false, RouteByLatency: false, })