package redis import ( "context" "gitea.baoapi.com/root/stu_uuos/config" redisv8 "github.com/go-redis/redis/v8" "log" ) var Rdb *redisv8.Client func Init() { cfg := config.GetConfig().Redis var err error Rdb = redisv8.NewClient( &redisv8.Options{ Addr: cfg.Addr, Password: "", DB: 1, }) _, err = Rdb.Ping(context.Background()).Result() if err != nil { log.Fatalf("redis error: %v\n", err) return } return }