package myredis import ( "context" "fmt" "testing" "time" ) func TestRedis(t *testing.T) { redis, err := NewDefault(&Config{ Addr: "127.0.0.1:6379", Password: "", DB: 15, PoolSize: 16, MinIdleConn: 4, MaxConnAge: "1h", IdleTimeout: "10m", }) if err != nil { fmt.Println(err) return } defer redis.Close() set, err := redis.Set(context.Background(), "name", "qwe123", time.Minute).Result() if err != nil { fmt.Println(err) return } fmt.Println(set) get, err := redis.Get(context.Background(), "name").Result() if err != nil { fmt.Println(err) return } fmt.Println(get) }