【laravel】 Laravel延迟队列
时间:2019-08-11 20:36:16
收藏:0
阅读:413
定义延迟队列的两种方式
三、通过
一 、任务分发的时候指定
\App\Jobs\Jober::dispatch()->delay(20);
二、定义Jober时构造方法中指定
<?php
namespace App\Jobs;
---------------------------------------------------
class Timer implements ShouldQueue
{
-----------------------------------------------
public function __construct()
{
$this->delay(20);
}
/**
* Execute the job.
* @return void
*/
public function handle()
{
---------------------------------------------------
}
}
三、通过 delay 属性指定
<?php
namespace App\Jobs;
---------------------------------------------------
class Timer implements ShouldQueue
{
public $delay = 30;
-----------------------------------------------
public function __construct()
{
}
/**
* Execute the job.
* @return void
*/
public function handle()
{
---------------------------------------------------
}
}原文:https://blog.51cto.com/suiwnet/2428598
评论(0)