17 lines
326 B
Go
17 lines
326 B
Go
package client
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/redis/go-redis/v9"
|
|
)
|
|
|
|
// NewRedisClient 初始化 Redis 客户端
|
|
func NewRedisClient(host string, port int, password string, db int) *redis.Client {
|
|
return redis.NewClient(&redis.Options{
|
|
Addr: fmt.Sprintf("%s:%d", host, port),
|
|
Password: password,
|
|
DB: db,
|
|
})
|
|
}
|