main
lizifeng 2023-05-17 19:14:45 +08:00
parent c9e3d8f858
commit 026bba1221
1 changed files with 3 additions and 2 deletions

View File

@ -1,6 +1,7 @@
package myredis package myredis
import ( import (
"context"
"fmt" "fmt"
"testing" "testing"
"time" "time"
@ -22,14 +23,14 @@ func TestRedis(t *testing.T) {
} }
defer redis.Close() defer redis.Close()
set, err := redis.Set("name", "qwe123", time.Minute) set, err := redis.Set(context.Background(), "name", "qwe123", time.Minute).Result()
if err != nil { if err != nil {
fmt.Println(err) fmt.Println(err)
return return
} }
fmt.Println(set) fmt.Println(set)
get, err := redis.Get("name") get, err := redis.Get(context.Background(), "name").Result()
if err != nil { if err != nil {
fmt.Println(err) fmt.Println(err)
return return