1.增加互斥锁:保证缓存和数据库数据一致性

2.增加消费队列,保证mysql数据的正常保存
This commit is contained in:
2026-04-20 14:13:48 +08:00
parent 614fb00ec4
commit 1eed3cf0f7
23 changed files with 836 additions and 255 deletions

View File

@@ -2,7 +2,7 @@
namespace app\common\model;
use app\common\service\GameHotDataRedis;
use app\common\service\GameHotDataCoordinator;
use support\think\Model;
/**
@@ -68,7 +68,7 @@ class User extends Model
{
$id = filter_var($model->getAttr('id'), FILTER_VALIDATE_INT);
if ($id !== false && $id > 0) {
GameHotDataRedis::userForget($id);
GameHotDataCoordinator::afterUserCommitted($id);
}
}
@@ -76,7 +76,7 @@ class User extends Model
{
$id = filter_var($model->getAttr('id'), FILTER_VALIDATE_INT);
if ($id !== false && $id > 0) {
GameHotDataRedis::userForget($id);
GameHotDataCoordinator::afterUserCommitted($id);
}
}
}