Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewManagerMemory ¶
func NewManagerMemory() *managerMemory
func NewManagerRedis ¶
Types ¶
type Manager ¶
type Manager interface { // RegisterSession 注册一个新的会话 RegisterSession(sessionId string) (Session, error) // UnRegisterSession 注销一个会话 UnRegisterSession(session Session) error // GetAllSession 获取所有会话 GetAllSession() ([]Session, error) // GetSession 获取特定id的会话 GetSession(sessionId string) (Session, error) // SetExpire 设置会话过期时间(默认 0, 永不过期) SetExpire(expire time.Duration) error }
Manager 会话管理器实现
可供给各种用途使用session管理
type Session ¶
type Session interface { // GetId 获取会话ID GetId() string // Store 向会话中存储数据 Store(key string, data interface{}) error // Load 加载会话中的数据 Load(key string) (interface{}, error) // Del 删除会话中的数据 Del(key string) error // Close 结束会话 Close() error // GetSessionManager 获取会话管理器 GetSessionManager() Manager // IsExpire 是否已过期 IsExpire() bool // SetExpire 设置过期时间 SetExpire(expire time.Duration) error }
Session 会话实现
Click to show internal directories.
Click to hide internal directories.