Session 支援
session 整合
//related to session
SessionOn bool // 是否開啟 session 模組,預設不開啟
SessionProvider string // session 後端提供處理模組,預設是 sessionManager 支援的 memory
SessionName string // 客戶端儲存的 cookies 的名稱
SessionGCMaxLifetime int64 // cookies 有效期
GlobalSessions *session.Manager //全域性 session 控制器if ar, err := AppConfig.Bool("sessionon"); err != nil {
SessionOn = false
} else {
SessionOn = ar
}
if ar := AppConfig.String("sessionprovider"); ar == "" {
SessionProvider = "memory"
} else {
SessionProvider = ar
}
if ar := AppConfig.String("sessionname"); ar == "" {
SessionName = "beegosessionID"
} else {
SessionName = ar
}
if ar, err := AppConfig.Int("sessiongcmaxlifetime"); err != nil && ar != 0 {
int64val, _ := strconv.ParseInt(strconv.Itoa(ar), 10, 64)
SessionGCMaxLifetime = int64val
} else {
SessionGCMaxLifetime = 3600
}session 使用
links
Last updated