feat(redis): support confiuring username (#1752)

替换Golang Redis依赖: redigo的版本至当前最新版1.8.9
(v2.0.0被标记为已撤回,且长期未更新)

Redis 6 及以上版本均可配置为使用username+password认证的ACL,故作此变更。
This commit is contained in:
初雪
2023-07-05 23:12:33 +09:00
committed by GitHub
parent 9f6f9adc89
commit ce759c02b1
6 changed files with 9 additions and 4 deletions

3
pkg/cache/redis.go vendored
View File

@@ -44,7 +44,7 @@ func deserializer(value []byte) (interface{}, error) {
}
// NewRedisStore 创建新的redis存储
func NewRedisStore(size int, network, address, password, database string) *RedisStore {
func NewRedisStore(size int, network, address, user, password, database string) *RedisStore {
return &RedisStore{
pool: &redis.Pool{
MaxIdle: size,
@@ -63,6 +63,7 @@ func NewRedisStore(size int, network, address, password, database string) *Redis
network,
address,
redis.DialDatabase(db),
redis.DialUsername(user),
redis.DialPassword(password),
)
if err != nil {