Commit bf3866f7 authored by hujiebin's avatar hujiebin

feat: 加载数据到lru打点

parent 57852e6e
......@@ -20,6 +20,7 @@ var userVips = make(map[mysql.ID]bool) // userId->isVip
// 加载数据到lru
func LoadAllSvipVipNoble(model *domain.Model) {
start := time.Now()
var svips []UserLevel
svipMap := make(map[mysql.ID]int)
if err := model.DB().Table("user_svip").Select("user_id,level").Where("level > 0").Find(&svips).Error; err != nil {
......@@ -56,7 +57,8 @@ func LoadAllSvipVipNoble(model *domain.Model) {
svipLevel = svipMap
nobleLevel = nobleMap
userVips = vipMap
defer svipVipNobleLock.Unlock()
svipVipNobleLock.Unlock()
model.Log.Infof("LoadAllSvipVipNoble svip:%v,vip:%v,noble:%v,cost:%vs", len(svipMap), len(vipMap), len(nobleMap), time.Now().Sub(start).Seconds())
}
func BatchGetNobleLevel(model *domain.Model, userIds []uint64) map[uint64]uint16 {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment