session

package
v1.0.21 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 10, 2025 License: MulanPSL-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SessionMapsCount int64 = 1000 // 降低锁粒度,提高并发度
)

Variables

This section is empty.

Functions

func AddSession

func AddSession(session ISession)

func GetCount

func GetCount() int64

func RemoveSession

func RemoveSession(sessionID int64)

func TraverseDo

func TraverseDo(f func(ISession, interface{}), paramData interface{})

Types

type ISession

type ISession interface {
	ID() string
	UID() int64
	SyncSet(key string, value interface{})
	SyncGet(key string) (value interface{})
	SyncRemove(key string)
	Set(key string, value interface{})
	Get(key string) interface{}
	Remove(key string)
}

func GetSession

func GetSession(sessionID int64) ISession

type ISessionPool

type ISessionPool interface {
	GetCount() int64

	RemoveSession(uid int64)

	AddSession(pSession ISession)

	GetSession(uId int64) ISession

	TraverseDo(f func(ISession, interface{}), paramData interface{})
}

type ISessionPoolBuilder

type ISessionPoolBuilder interface {
	GetSessionPool(int64) ISessionPool
}

type Session

type Session struct {
	// contains filtered or unexported fields
}

func NewSession

func NewSession(sessionID string, sessionUID int64) (s *Session)

func (*Session) Get

func (s *Session) Get(key string) interface{}

func (*Session) ID

func (s *Session) ID() string

func (*Session) Remove

func (s *Session) Remove(key string)

func (*Session) Set

func (s *Session) Set(key string, value interface{})

func (*Session) SyncGet

func (s *Session) SyncGet(key string) (value interface{})

func (*Session) SyncRemove

func (s *Session) SyncRemove(key string)

func (*Session) SyncSet

func (s *Session) SyncSet(key string, value interface{})

func (*Session) UID

func (s *Session) UID() int64

type SessionMap

type SessionMap struct {
	// contains filtered or unexported fields
}

func NewSessionMap

func NewSessionMap() (ret *SessionMap)

func (*SessionMap) TraverseDo

func (sessionMap *SessionMap) TraverseDo(f func(ISession, interface{}), paramData interface{})

type SessionPool

type SessionPool struct {
	// contains filtered or unexported fields
}

func NewSessionPool

func NewSessionPool() (ret *SessionPool)

func (*SessionPool) AddSession

func (sessionPool *SessionPool) AddSession(pSession ISession)

func (*SessionPool) GetCount

func (sessionPool *SessionPool) GetCount() int64

func (*SessionPool) GetSession

func (sessionPool *SessionPool) GetSession(uId int64) ISession

func (*SessionPool) RemoveSession

func (sessionPool *SessionPool) RemoveSession(uid int64)

func (*SessionPool) TraverseDo

func (sessionPool *SessionPool) TraverseDo(f func(ISession, interface{}), paramData interface{})

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL