Files
gf/net/ghttp/ghttp_server_config_session.go

34 lines
770 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 (
"time"
"github.com/gogf/gf/os/gsession"
)
2018-09-14 13:02:13 +08:00
func (s *Server) SetSessionMaxAge(ttl time.Duration) {
s.config.SessionMaxAge = ttl
2018-09-14 13:02:13 +08:00
}
func (s *Server) SetSessionIdName(name string) {
2019-06-19 09:06:52 +08:00
s.config.SessionIdName = name
2018-09-14 13:02:13 +08:00
}
func (s *Server) SetSessionStorage(storage gsession.Storage) {
s.config.SessionStorage = storage
}
func (s *Server) GetSessionMaxAge() time.Duration {
2019-06-19 09:06:52 +08:00
return s.config.SessionMaxAge
2018-09-14 13:02:13 +08:00
}
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
}