本文整理汇总了PHP中Illuminate\Queue\Jobs\Job::autoDelete方法的典型用法代码示例。如果您正苦于以下问题:PHP Job::autoDelete方法的具体用法?PHP Job::autoDelete怎么用?PHP Job::autoDelete使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Queue\Jobs\Job
的用法示例。
在下文中一共展示了Job::autoDelete方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: process
/**
* Process a given job from the queue.
*
* @param \Illuminate\Queue\Jobs\Job $job
* @param int $delay
* @return void
*/
public function process(Job $job, $delay)
{
try {
// First we will fire off the job. Once it is done we will see if it will
// be auto-deleted after processing and if so we will go ahead and run
// the delete method on the job. Otherwise we will just keep moving.
$job->fire();
if ($job->autoDelete()) {
$job->delete();
}
} catch (\Exception $e) {
// If we catch an exception, we will attempt to release the job back onto
// the queue so it is not lost. This will let is be retried at a later
// time by another listener (or the same one). We will do that here.
$job->release($delay);
throw $e;
}
}