perf: 重构敏感词过滤为DFA算法,并引入WebSocket房间频道鉴权Redis缓存
This commit is contained in:
@@ -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}");
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user