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
+3 -1
View File
@@ -9,7 +9,9 @@ Broadcast::channel('App.Models.User.{id}', function ($user, $id) {
// 聊天室房间 Presence Channel 鉴权与成员信息抓取
Broadcast::channel('room.{roomId}', function ($user, $roomId) {
$room = \App\Models\Room::find($roomId);
$room = \Illuminate\Support\Facades\Cache::remember("room:meta:{$roomId}", 300, function () use ($roomId) {
return \App\Models\Room::find($roomId);
});
if (! $room || ! $room->canUserEnter($user)) {
return false;
}