12345678910111213141516171819202122232425 |
- package global
- import (
- "context"
- "fmt"
- "github.com/go-redis/redis/v8"
- )
- var Rdb *redis.Client
- func init() {
- //addr := RedisSetting.Addr
- //password := RedisSetting.Password
- //db := RedisSetting.DB
- Rdb = redis.NewClient(&redis.Options{
- Addr: "192.168.11.70:6379",
- Password: "",
- DB: 0,
- })
- ctx := context.Background()
- _, err := Rdb.Ping(ctx).Result()
- if err != nil {
- fmt.Println(err)
- }
- }
|