You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

27 lines
448 B

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
}