优化
This commit is contained in:
parent
d0aec519d1
commit
1dfa4cda64
@ -1,10 +1,9 @@
|
||||
package game
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"database/sql"
|
||||
"encoding/gob"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"math"
|
||||
"server/GoUtil"
|
||||
@ -980,14 +979,8 @@ func (p *Player) UpdateUserInfo() {
|
||||
simple.ActLog = p.PlayMod.getFriendMod().GetActLogLast()
|
||||
simple.Physiology = p.PlayMod.getPlayroomMod().GetPhysiologyList()
|
||||
|
||||
// 使用 gob 编码替代 json,生成更紧凑的二进制
|
||||
var buf bytes.Buffer
|
||||
enc := gob.NewEncoder(&buf)
|
||||
if err := enc.Encode(simple); err != nil {
|
||||
log.Debug("gob encode simple failed: %v", err)
|
||||
return
|
||||
}
|
||||
value := buf.Bytes()
|
||||
//TODO 存储到redis 在新版本中将优化成gob进行压缩
|
||||
value, _ := json.Marshal(simple)
|
||||
IdStr := strconv.Itoa(int(p.M_DwUin))
|
||||
go db.RedisSetKeyBytes(IdStr, value, 0)
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user