From 76fd2488095d58ab7c9f120f90f7ed83745ee320 Mon Sep 17 00:00:00 2001 From: xiaomlove Date: Fri, 26 Apr 2024 03:46:18 +0800 Subject: [PATCH] event idKey add prefix, change ttl --- include/globalfunctions.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/include/globalfunctions.php b/include/globalfunctions.php index 2f3b7ad9..c821af7c 100644 --- a/include/globalfunctions.php +++ b/include/globalfunctions.php @@ -1239,12 +1239,12 @@ function get_snatch_info($torrentId, $userId) function fire_event(string $name, \Illuminate\Database\Eloquent\Model $model, \Illuminate\Database\Eloquent\Model $oldModel = null): void { - $idKey = \Illuminate\Support\Str::random(); + $idKey = "fire_event:" . \Illuminate\Support\Str::random(); $idKeyOld = ""; - \Nexus\Database\NexusDB::cache_put($idKey, serialize($model)); + \Nexus\Database\NexusDB::cache_put($idKey, serialize($model), 3600*24*30); if ($oldModel) { - $idKeyOld = \Illuminate\Support\Str::random(); - \Nexus\Database\NexusDB::cache_put($idKeyOld, serialize($oldModel)); + $idKeyOld = "fire_event:" . \Illuminate\Support\Str::random(); + \Nexus\Database\NexusDB::cache_put($idKeyOld, serialize($oldModel), 3600*24*30); } executeCommand("event:fire --name=$name --idKey=$idKey --idKeyOld=$idKeyOld", "string", true, false); }