Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Config = struct { CookieName string // 客户端储存sessionID的cookie的名字 CookieLifeTime int // cookie保存时间,单位秒 HTTPOnly bool Gclifetime int64 // GC间隔时间,并不一定精准,单位秒 Maxlifetime int64 // session保存时间,单位秒 }{ "SESSIONID", 0, true, 3600, 600, }
Config 配置参数
View Source
var Engine struct { Read func(sid string) (map[string]*Data, error) // 通过sessionID读取数据 Save func(sid string, d map[string]*Data) error // 保存数据 Destroy func(sid string) error // 通过sessionID删除数据 GC func() }
Engine session引擎开发相关,需要考虑并发情况
View Source
var UtilGenerateSessionID = func() string { return util.BytesString(util.GetRandStr()) }
UtilGenerateSessionID 随机生成不重复SessionID
Functions ¶
func UtilGetSIDFromRequest ¶
UtilGetSIDFromRequest 从请求中获取sessionID
Types ¶
Click to show internal directories.
Click to hide internal directories.