123456789101112131415161718192021222324 |
- package global
- import (
- "context"
- "fmt"
- "github.com/go-redis/redis/v8"
- "project_management/simple_zap"
- )
- var Rdb *redis.Client
- func SetupRedisLink() {
- Rdb = redis.NewClient(&redis.Options{
- Addr: RedisSetting.Addr,
- Password: "",
- DB: 0,
- })
- ctx := context.Background()
- _, err := Rdb.Ping(ctx).Result()
- if err != nil {
- simple_zap.WithCtx(context.Background()).Sugar().Warn("redis连接失败", err)
- fmt.Println(err)
- }
- }
|