1
0
mirror of https://github.com/redis/go-redis.git synced 2025-07-31 05:04:23 +03:00

feat: support Elasticache cluster mode by introducing IsClusterMode config param (#3255)

Co-authored-by: Rushikesh Joshi <rushikesh.joshi@sap.com>
Co-authored-by: Nedyalko Dyakov <nedyalko.dyakov@gmail.com>
This commit is contained in:
Rushikesh Joshi
2025-02-26 08:25:55 -08:00
committed by GitHub
parent d4e74b125d
commit 7d55118554
2 changed files with 21 additions and 1 deletions

View File

@ -69,6 +69,9 @@ type UniversalOptions struct {
DisableIndentity bool
IdentitySuffix string
UnstableResp3 bool
// IsClusterMode can be used when only one Addrs is provided (e.g. Elasticache supports setting up cluster mode with configuration endpoint).
IsClusterMode bool
}
// Cluster returns cluster options created from the universal options.
@ -244,7 +247,7 @@ var (
func NewUniversalClient(opts *UniversalOptions) UniversalClient {
if opts.MasterName != "" {
return NewFailoverClient(opts.Failover())
} else if len(opts.Addrs) > 1 {
} else if len(opts.Addrs) > 1 || opts.IsClusterMode {
return NewClusterClient(opts.Cluster())
}
return NewClient(opts.Simple())