fix: new cache(redis) uri invalid

This commit is contained in:
zhaoyupeng
2025-06-23 17:04:06 +08:00
parent 6d1024f951
commit b6ee2966cf
2 changed files with 35 additions and 1 deletions

View File

@ -22,7 +22,7 @@ func WithCtx(ctx context.Context) OptionFn {
func WithRedis(host string, port int, username, password string) OptionFn {
return func(c *config) {
uri := fmt.Sprintf("%s:%d", host, port)
uri := fmt.Sprintf("redis://%s:%d", host, port)
if username != "" || password != "" {
uri = fmt.Sprintf("redis://%s:%s@%s:%d", username, password, host, port)
}