event idKey add prefix, change ttl

This commit is contained in:
xiaomlove
2024-04-26 03:46:18 +08:00
parent 8a44a0a269
commit 76fd248809

View File

@@ -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);
}