Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
tangtaoit committed Aug 1, 2023
2 parents 0947fd5 + 6409832 commit 878675c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions pkg/db/redis.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ package db

import "github.com/TangSengDaoDao/TangSengDaoDaoServer/pkg/redis"

func NewRedis(addr string) *redis.Conn {
return redis.New(addr)
func NewRedis(addr string, password string) *redis.Conn {
return redis.New(addr, password)
}
3 changes: 2 additions & 1 deletion pkg/redis/redis.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,12 @@ type Conn struct {
client *rd.Client
}

func New(addr string) *Conn {
func New(addr string, password string) *Conn {
c := &Conn{}
c.client = rd.NewClient(&rd.Options{
Addr: addr,
MaxRetries: 3, // 失败重试次数
Password: password,
})
return c
}
Expand Down

0 comments on commit 878675c

Please sign in to comment.