Documentation ¶
Index ¶
- Constants
- func NewSessionId() string
- type Manager
- type MemStore
- func (store *MemStore) ActiveCount() int
- func (store *MemStore) CleanExpire()
- func (store *MemStore) GetSession(sessionId string) *Session
- func (store *MemStore) RemoveSession(sessionId ...string)
- func (store *MemStore) SaveSession(sessionId string, session *Session)
- func (store *MemStore) SessionExist(sessionId string) bool
- type Session
- func (s *Session) ClearState()
- func (s *Session) Get(name string) any
- func (s *Session) GetAll() map[string]any
- func (s *Session) GetId() string
- func (s *Session) IsDirty() bool
- func (s *Session) IsExpire() bool
- func (s *Session) IsNew() bool
- func (s *Session) Remove(name string)
- func (s *Session) Save()
- func (s *Session) Set(name string, value any)
- func (s *Session) SetMap(data map[string]any)
- type Store
Constants ¶
View Source
const ( MemoryStore = "memory" RedisStore = "redis" MemcachedStore = "memcached" )
Variables ¶
This section is empty.
Functions ¶
func NewSessionId ¶
func NewSessionId() string
Types ¶
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
func (*Manager) NewSession ¶
type MemStore ¶
type MemStore struct { *concurrent.Map[string, *Session] // contains filtered or unexported fields }
MemStore 内存中存储session,只适用于单节点应用
func (*MemStore) ActiveCount ¶
ActiveCount 统计当前有效的session数量 ,并且同时会清理过期的session
func (*MemStore) GetSession ¶
GetSession 获取session,如果已经过期那么返回一个空
func (*MemStore) RemoveSession ¶
RemoveSession 移除会话
func (*MemStore) SaveSession ¶
SaveSession 存取session
func (*MemStore) SessionExist ¶
SessionExist 会话是否存在
type Session ¶
type Session struct {
// contains filtered or unexported fields
}
func (*Session) ClearState ¶
func (s *Session) ClearState()
Click to show internal directories.
Click to hide internal directories.