github.com/zhongdalu/gf@v1.0.0/g/net/ghttp/ghttp_server_config_session.go (about)

     1  // Copyright 2017 gf Author(https://github.com/zhongdalu/gf). All Rights Reserved.
     2  //
     3  // This Source Code Form is subject to the terms of the MIT License.
     4  // If a copy of the MIT was not distributed with this file,
     5  // You can obtain one at https://github.com/zhongdalu/gf.
     6  
     7  package ghttp
     8  
     9  import "github.com/zhongdalu/gf/g/os/glog"
    10  
    11  // 设置http server参数 - SessionMaxAge
    12  func (s *Server) SetSessionMaxAge(age int) {
    13  	if s.Status() == SERVER_STATUS_RUNNING {
    14  		glog.Error(gCHANGE_CONFIG_WHILE_RUNNING_ERROR)
    15  		return
    16  	}
    17  	s.config.SessionMaxAge = age
    18  }
    19  
    20  // 设置http server参数 - SessionIdName
    21  func (s *Server) SetSessionIdName(name string) {
    22  	if s.Status() == SERVER_STATUS_RUNNING {
    23  		glog.Error(gCHANGE_CONFIG_WHILE_RUNNING_ERROR)
    24  		return
    25  	}
    26  	s.config.SessionIdName = name
    27  }
    28  
    29  // 获取http server参数 - SessionMaxAge
    30  func (s *Server) GetSessionMaxAge() int {
    31  	return s.config.SessionMaxAge
    32  }
    33  
    34  // 获取http server参数 - SessionIdName
    35  func (s *Server) GetSessionIdName() string {
    36  	return s.config.SessionIdName
    37  }