1
0
mirror of https://github.com/gogf/gf.git synced 2025-04-05 11:18:50 +08:00
John Guo 6ff4ed84e5
version v2.3.0 (#2392)
* v2.3.0

* up

* up

* up
2023-01-11 19:19:41 +08:00

35 lines
599 B
Go

package main
import (
"fmt"
"time"
_ "github.com/gogf/gf/contrib/nosql/redis/v2"
"github.com/gogf/gf/v2/frame/g"
"github.com/gogf/gf/v2/os/gctx"
)
func main() {
var ctx = gctx.New()
err := g.Redis().SetEX(ctx, "key", "value", 1)
if err != nil {
g.Log().Fatal(ctx, err)
}
value, err := g.Redis().Get(ctx, "key")
if err != nil {
g.Log().Fatal(ctx, err)
}
fmt.Println(value.IsNil())
fmt.Println(value.String())
time.Sleep(time.Second)
value, err = g.Redis().Get(ctx, "key")
if err != nil {
g.Log().Fatal(ctx, err)
}
fmt.Println(value.IsNil())
fmt.Println(value.Val())
}