Documentation ¶
Index ¶
- type Session
- type SessionMgr
- func (mgr *SessionMgr) Del(sessionID string, key interface{}) bool
- func (mgr *SessionMgr) Destroy(w http.ResponseWriter, r *http.Request)
- func (mgr *SessionMgr) EndSessionBy(sessionID string)
- func (mgr *SessionMgr) GC()
- func (mgr *SessionMgr) Get(sessionID string, key interface{}) (interface{}, bool)
- func (mgr *SessionMgr) GetLastAccessTime(sessionID string) time.Time
- func (mgr *SessionMgr) GetSessionID(w http.ResponseWriter, r *http.Request) string
- func (mgr *SessionMgr) GetSessionIDList() []string
- func (mgr *SessionMgr) NewSessionID() string
- func (mgr *SessionMgr) Set(sessionID string, key interface{}, value interface{})
- func (mgr *SessionMgr) StartSession(w http.ResponseWriter, r *http.Request) string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Session ¶
type Session struct {
// contains filtered or unexported fields
}
—————————————————————————— 会话
type SessionMgr ¶
type SessionMgr struct {
// contains filtered or unexported fields
}
Session会话管理
func NewSessionMgr ¶
func NewSessionMgr(cookieName string, maxLifeTime int64) *SessionMgr
创建会话管理器(cookieName:在浏览器中cookie的名字;maxLifeTime:最长生命周期)
func (*SessionMgr) Del ¶
func (mgr *SessionMgr) Del(sessionID string, key interface{}) bool
得到session里面的值
func (*SessionMgr) Destroy ¶
func (mgr *SessionMgr) Destroy(w http.ResponseWriter, r *http.Request)
销毁Session
func (*SessionMgr) Get ¶
func (mgr *SessionMgr) Get(sessionID string, key interface{}) (interface{}, bool)
得到session里面的值
func (*SessionMgr) GetLastAccessTime ¶
func (mgr *SessionMgr) GetLastAccessTime(sessionID string) time.Time
更新最后访问时间
func (*SessionMgr) GetSessionID ¶
func (mgr *SessionMgr) GetSessionID(w http.ResponseWriter, r *http.Request) string
判断Cookie的合法性(每进入一个页面都需要判断合法性)
func (*SessionMgr) GetSessionIDList ¶
func (mgr *SessionMgr) GetSessionIDList() []string
得到sessionID列表
func (*SessionMgr) Set ¶
func (mgr *SessionMgr) Set(sessionID string, key interface{}, value interface{})
设置session里面的值
func (*SessionMgr) StartSession ¶
func (mgr *SessionMgr) StartSession(w http.ResponseWriter, r *http.Request) string
在开始页面登陆页面,开始Session
Click to show internal directories.
Click to hide internal directories.