Files
gf/g/net/ghttp/ghttp_server_config_session.go

38 lines
1011 B
Go
Raw Normal View History

// Copyright 2017 gf Author(https://github.com/gogf/gf). All Rights Reserved.
2018-09-14 13:02:13 +08:00
//
// This Source Code Form is subject to the terms of the MIT License.
// If a copy of the MIT was not distributed with this file,
// You can obtain one at https://github.com/gogf/gf.
2018-09-14 13:02:13 +08:00
package ghttp
import "github.com/gogf/gf/g/os/glog"
2018-09-14 13:02:13 +08:00
// 设置http server参数 - SessionMaxAge
func (s *Server) SetSessionMaxAge(age int) {
2019-06-19 09:06:52 +08:00
if s.Status() == SERVER_STATUS_RUNNING {
glog.Error(gCHANGE_CONFIG_WHILE_RUNNING_ERROR)
return
}
s.config.SessionMaxAge = age
2018-09-14 13:02:13 +08:00
}
// 设置http server参数 - SessionIdName
func (s *Server) SetSessionIdName(name string) {
2019-06-19 09:06:52 +08:00
if s.Status() == SERVER_STATUS_RUNNING {
glog.Error(gCHANGE_CONFIG_WHILE_RUNNING_ERROR)
return
}
s.config.SessionIdName = name
2018-09-14 13:02:13 +08:00
}
// 获取http server参数 - SessionMaxAge
func (s *Server) GetSessionMaxAge() int {
2019-06-19 09:06:52 +08:00
return s.config.SessionMaxAge
2018-09-14 13:02:13 +08:00
}
// 获取http server参数 - SessionIdName
func (s *Server) GetSessionIdName() string {
2019-06-19 09:06:52 +08:00
return s.config.SessionIdName
2018-09-14 13:02:13 +08:00
}