Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type SessionManager ¶
type SessionManager struct {
// contains filtered or unexported fields
}
* 会话管理器获取当前会话,GetDefault().Start(),从而进一步获取会话id,会话变量的存取
func GetDefault ¶
func GetDefault() *SessionManager
func NewSessionManager ¶
func NewSessionManager(poolName, cookieName string, maxLifetime int64) (*SessionManager, error)
func (*SessionManager) SessionDestroy ¶
func (this *SessionManager) SessionDestroy(w http.ResponseWriter, r *http.Request)
SessionDestroy 注销 Session
func (*SessionManager) SessionGC ¶
func (this *SessionManager) SessionGC()
func (*SessionManager) Start ¶
func (this *SessionManager) Start(w http.ResponseWriter, r *http.Request) (session *Session)
根据当前请求的cookie中判断是否存在有效的session, 不存在则创建
type SessionPool ¶
type SessionPool struct {
// contains filtered or unexported fields
}
* 会话池用于存放连接上来的多个会话,会话管理器Start的时候如果是新会话,将放入会话池
func (*SessionPool) Destroy ¶
func (this *SessionPool) Destroy(sid string) error
func (*SessionPool) Init ¶
func (this *SessionPool) Init(sid string) (*Session, error)
* SessionInit(sid string) (Session, error) SessionRead(sid string) (Session, error) SessionDestroy(sid string) error SessionGC(maxLifeTime int64)
func (*SessionPool) SessionGC ¶
func (this *SessionPool) SessionGC(maxlifetime int64)
func (*SessionPool) Update ¶
func (this *SessionPool) Update(sid string) error
Click to show internal directories.
Click to hide internal directories.