func main(){
sessionConfig := &session.ManagerConfig{
CookieName :"gocsessionid",
EnableSetCookie : true,
Gclifetime : 3600,
Maxlifetime : 3600,
Secure : false,
CookieLifeTime : 3600,
ProviderConfig :"127.0.0.1:6379,root",
}
gloabalSessions, _ = session.NewManager("redis",sessionConfig)
go gloabalSessions.GC()
}
提示错误
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x13b32a6]
goroutine 6 [running]:
github.com/astaxie/beego/session.(*Manager).GC(0x0)
在import 中添加 Redis
import(_"github.com/astaxie/beego/session/redis")
有疑问加站长微信联系(非本文作者)