如果检测到当前正在活跃,不删除缓存key

This commit is contained in:
ayflying
2025-09-03 10:02:34 +08:00
parent e1f1bea0e7
commit 62b0e429b3
2 changed files with 24 additions and 15 deletions

View File

@@ -498,6 +498,12 @@ func (s *sGameAct) Cache2SqlChan(ctx context.Context) {
// 删除缓存key
func (s *sGameAct) DelCacheKey(ctx context.Context, aid int, uid int64) {
//如果有活跃,跳过删除
if getBool, _ := pkg.Cache("redis").
Contains(ctx, fmt.Sprintf("act:update:%d", uid)); getBool {
return
}
cacheKey := fmt.Sprintf("act:%v:%v", aid, uid)
_, err := g.Redis().Del(ctx, cacheKey)
if err != nil {