perf: 重构敏感词过滤为DFA算法,并引入WebSocket房间频道鉴权Redis缓存

This commit is contained in:
pllx
2026-06-30 11:32:55 +08:00
parent b19073cf85
commit 83192ffcce
3 changed files with 85 additions and 8 deletions
+16
View File
@@ -139,4 +139,20 @@ class Room extends Model
|| $user->username === $this->master
|| $user->user_level >= $superLevel;
}
/**
* 模型的 booted 方法。
*
* 在房间被更新或删除时,同步清理 Redis 上的 Presence Channel 鉴权缓存。
*/
protected static function booted(): void
{
static::saved(function (Room $room) {
\Illuminate\Support\Facades\Cache::forget("room:meta:{$room->id}");
});
static::deleted(function (Room $room) {
\Illuminate\Support\Facades\Cache::forget("room:meta:{$room->id}");
});
}
}