Add readOnly and routeByLatency options to Redis Cluster Store

This commit is contained in:
Dakota Sullivan 2019-12-18 08:34:19 -07:00
parent 39810a9951
commit 301bc2f69d
No known key found for this signature in database
GPG Key ID: 229C619FF594AE57

View File

@ -22,13 +22,17 @@ func (store *RedisClusterStore) Initialize(configuration util.Configuration) (er
return store.initialize(
configuration.GetStringSlice("addresses"),
configuration.GetString("password"),
configuration.GetBool("connection_use_read_only"),
configuration.GetBool("connection_route_by_latency"),
)
}
func (store *RedisClusterStore) initialize(addresses []string, password string) (err error) {
func (store *RedisClusterStore) initialize(addresses []string, password string, readOnly, routeByLatency bool) (err error) {
store.Client = redis.NewClusterClient(&redis.ClusterOptions{
Addrs: addresses,
Password: password,
Addrs: addresses,
Password: password,
ReadOnly: readOnly,
RouteByLatency: routeByLatency,
})
return
}