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
import (
"context"
"fmt"
"testing"
"time"
@ -22,14 +23,14 @@ func TestRedis(t *testing.T) {
}
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 {
fmt.Println(err)
return
}
fmt.Println(set)
get, err := redis.Get("name")
get, err := redis.Get(context.Background(), "name").Result()
if err != nil {
fmt.Println(err)
return