This commit is contained in:
aozhiwei 2024-04-07 15:12:59 +08:00
parent da2f078f18
commit f3b9674d24

View File

@ -8,19 +8,12 @@ import (
"main/constant"
)
type pendingUser struct {
accountId string
reqTime int64
}
type cacheMgr struct {
userHash map[string]*userProfile
pendingHash map[string]*pendingUser
}
func (this *cacheMgr) Init() {
this.userHash = make(map[string]*userProfile)
this.pendingHash = make(map[string]*pendingUser)
}
func (this *cacheMgr) UnInit() {
@ -90,7 +83,20 @@ func (this *cacheMgr) AsyncSearch(sinceId int64, q string,
}
func (this *cacheMgr) internalGetUsers(accountIds []string, cb func(int32, string)) {
keys := [][]string{}
for _, accountId := range(accountIds) {
if this.getUser(accountId) == nil {
q5.AppendSlice(&keys, []string{constant.CACHE_LOCK_KEY, accountId})
}
}
if len(keys) <= 0{
cb(0, "")
return
}
f5.NewLockAsyncTask(
keys,
func (task *f5.LockAsyncTask) {
})
}
func (this *cacheMgr) getUser(accountId string) *userProfile {