improve session expire algorithm for gsession

This commit is contained in:
john
2019-09-15 12:17:44 +08:00
parent f128cb9f61
commit 1665d92136
8 changed files with 22 additions and 11 deletions

View File

@ -4,11 +4,12 @@ import (
"github.com/gogf/gf/frame/g"
"github.com/gogf/gf/net/ghttp"
"github.com/gogf/gf/os/gtime"
"time"
)
func main() {
s := g.Server()
s.SetSessionMaxAge(60)
s.SetSessionMaxAge(2 * time.Second)
s.BindHandler("/set", func(r *ghttp.Request) {
r.Session.Set("time", gtime.Second())
r.Response.Write("ok")