(cfg *Config, cfgBackground *cache.BackgroundConfig, name string, logger log.Logger)
| 16 | } |
| 17 | |
| 18 | func NewClient(cfg *Config, cfgBackground *cache.BackgroundConfig, name string, logger log.Logger) cache.Cache { |
| 19 | if cfg.ClientConfig.Timeout == 0 { |
| 20 | cfg.ClientConfig.Timeout = 100 * time.Millisecond |
| 21 | } |
| 22 | if cfg.ClientConfig.Expiration == 0 { |
| 23 | cfg.ClientConfig.Expiration = cfg.TTL |
| 24 | } |
| 25 | |
| 26 | client := cache.NewRedisClient(&cfg.ClientConfig) |
| 27 | c := cache.NewRedisCache(name, client, prometheus.DefaultRegisterer, logger) |
| 28 | |
| 29 | return cache.NewBackground(name, *cfgBackground, c, prometheus.DefaultRegisterer) |
| 30 | } |
no test coverage detected