From 9d43e492a8fc0b110d9261058370346a2fe1bb34 Mon Sep 17 00:00:00 2001 From: lei xia Date: Tue, 1 Dec 2020 10:12:46 +0800 Subject: [PATCH] feature(Redis): add db to config (#616) Co-authored-by: xialeistudio --- pkg/cache/redis/pool.go | 1 + pkg/cache/redis/redis.go | 1 + 2 files changed, 2 insertions(+) diff --git a/pkg/cache/redis/pool.go b/pkg/cache/redis/pool.go index df2d0829d..ecab41e29 100644 --- a/pkg/cache/redis/pool.go +++ b/pkg/cache/redis/pool.go @@ -58,6 +58,7 @@ func NewPool(c *Config, options ...DialOption) (p *Pool) { DialReadTimeout(time.Duration(c.ReadTimeout)), DialWriteTimeout(time.Duration(c.WriteTimeout)), DialPassword(c.Auth), + DialDatabase(c.Db), } ops = append(ops, options...) p1 := pool.NewSlice(c.Config) diff --git a/pkg/cache/redis/redis.go b/pkg/cache/redis/redis.go index a664cfe51..634dc1cd9 100644 --- a/pkg/cache/redis/redis.go +++ b/pkg/cache/redis/redis.go @@ -34,6 +34,7 @@ type Config struct { Proto string Addr string Auth string + Db int DialTimeout xtime.Duration ReadTimeout xtime.Duration WriteTimeout xtime.Duration