From c22a036b7fc7c33e9720ce4ff0379a53cfb64dad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=80=E5=8F=B6=E7=9F=A5=E7=A7=8B?= <42715919+sappan@users.noreply.github.com> Date: Thu, 22 Aug 2024 12:08:44 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=A2=9E=E5=8A=A0=E4=B8=80=E4=B8=AA?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E4=BF=A1=E6=81=AF=E6=8E=A5=E5=8F=A3=20(#793)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cache/redis.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cache/redis.go b/cache/redis.go index f51f7bf88..bcaa8b85a 100644 --- a/cache/redis.go +++ b/cache/redis.go @@ -16,6 +16,7 @@ type Redis struct { // RedisOpts redis 连接属性 type RedisOpts struct { Host string `yml:"host" json:"host"` + Username string `yaml:"username" json:"username"` Password string `yml:"password" json:"password"` Database int `yml:"database" json:"database"` MaxIdle int `yml:"max_idle" json:"max_idle"` @@ -28,6 +29,7 @@ func NewRedis(ctx context.Context, opts *RedisOpts) *Redis { conn := redis.NewUniversalClient(&redis.UniversalOptions{ Addrs: []string{opts.Host}, DB: opts.Database, + Username: opts.Username, Password: opts.Password, IdleTimeout: time.Second * time.Duration(opts.IdleTimeout), MinIdleConns: opts.MaxIdle,