Upsteam sync

This commit is contained in:
Senad Uka
2018-05-07 16:39:23 +02:00
committed by GotPPay
parent cbbbdc601b
commit 1ed02e2e73
7 changed files with 11 additions and 3 deletions

View File

@@ -31,10 +31,11 @@ type RedisCache struct {
func Instance(cfg *config.Config) contract.CacheManager {
once.Do(func() {
client := redis.NewFailoverClient(&redis.FailoverOptions{
MasterName: "master01",
MasterName: cfg.Cache.Master,
SentinelAddrs: []string{fmt.Sprintf("%s:%v", cfg.Cache.Server, cfg.Cache.Port)},
Password: cfg.Cache.Pass,
DB: cfg.Cache.DB,
MaxRetries: 10,
})
instance = &RedisCache{cfg, client}

View File

@@ -120,6 +120,7 @@ type CacheConfig struct {
Pass string
Prefix string
DefaultExpiration time.Duration
Master string
}
// CacheConfig represents the configuration values about the documentation config.
@@ -199,6 +200,7 @@ func Read() (*Config, error) {
Pass: viper.GetString("cache.pass"),
Prefix: viper.GetString("cache.prefix"),
DefaultExpiration: viper.GetDuration("cache.default-expiration"),
Master: viper.GetString("cache.master-name"),
},
Lyft: LyftConfig{
Client: viper.GetString("lyft.key"),