1
This commit is contained in:
parent
da2f078f18
commit
f3b9674d24
22
server/imserver_new/cache/cachemgr.go
vendored
22
server/imserver_new/cache/cachemgr.go
vendored
@ -8,19 +8,12 @@ import (
|
|||||||
"main/constant"
|
"main/constant"
|
||||||
)
|
)
|
||||||
|
|
||||||
type pendingUser struct {
|
|
||||||
accountId string
|
|
||||||
reqTime int64
|
|
||||||
}
|
|
||||||
|
|
||||||
type cacheMgr struct {
|
type cacheMgr struct {
|
||||||
userHash map[string]*userProfile
|
userHash map[string]*userProfile
|
||||||
pendingHash map[string]*pendingUser
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *cacheMgr) Init() {
|
func (this *cacheMgr) Init() {
|
||||||
this.userHash = make(map[string]*userProfile)
|
this.userHash = make(map[string]*userProfile)
|
||||||
this.pendingHash = make(map[string]*pendingUser)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *cacheMgr) UnInit() {
|
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)) {
|
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 {
|
func (this *cacheMgr) getUser(accountId string) *userProfile {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user