- gameAct: 新增SaveV2Batch批量处理方法 - 使用Redis MGET批量获取替代逐个GET - 使用WHERE uid IN批量查询替代逐个查询 - 使用Batch批量插入替代逐条SQL - 修复: 只有数据库写入成功后才删除Redis key - gameKv: 新增SavesV2Batch批量处理方法 - 同样的批量优化策略 - 修复: 只有数据库写入成功后才删除Redis key - service: 更新接口定义添加新方法 性能提升: 1000条数据从1000次网络请求减少到2-3次
41 lines
1017 B
Go
41 lines
1017 B
Go
// ================================================================================
|
||
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
|
||
// You can delete these comments if you wish manually maintain this interface file.
|
||
// ================================================================================
|
||
|
||
package service
|
||
|
||
import (
|
||
"context"
|
||
)
|
||
|
||
type (
|
||
IGameKv interface {
|
||
// SavesV1 方法
|
||
//
|
||
// @Description: 保存用户KV数据列表。
|
||
// @receiver s: sGameKv的实例。
|
||
// @return err: 错误信息,如果操作成功,则为nil。
|
||
SavesV1() (err error)
|
||
// SavesV2Batch 批量保存游戏KV数据 (优化版)
|
||
SavesV2Batch(ctx context.Context, cacheKeys []string) (err error)
|
||
// 删除缓存key
|
||
DelCacheKey(ctx context.Context, uid int64)
|
||
}
|
||
)
|
||
|
||
var (
|
||
localGameKv IGameKv
|
||
)
|
||
|
||
func GameKv() IGameKv {
|
||
if localGameKv == nil {
|
||
panic("implement not found for interface IGameKv, forgot register?")
|
||
}
|
||
return localGameKv
|
||
}
|
||
|
||
func RegisterGameKv(i IGameKv) {
|
||
localGameKv = i
|
||
}
|