This commit is contained in:
aozhiwei 2024-05-25 11:15:20 +08:00
parent 7edbb6eafb
commit 53ebf98467

View File

@ -1,12 +1,31 @@
package session
import (
"q5"
"sync"
)
type session struct {
accountId string
lastUpdateTick int64
}
type sessionMgr struct {
idHash sync.Map
}
func (this *sessionMgr) UpdateSession(accountId string, sessionId string) {
session := this.getSession(accountId)
if session != nil {
session.lastUpdateTick = q5.GetTickCount()
return
}
}
func (this *sessionMgr) getSession(accountId string) *session {
if p, ok := this.idHash.Load(accountId); ok {
return p.(*session)
} else {
return nil
}
}