Laravel Redis 隊列支持以下操作:
dispatch(new App\Jobs\YourJob());
php artisan queue:listen
或 php artisan queue:work
命令來監(jiān)聽隊列并處理任務(wù)。dispatch(new App\Jobs\YourJob())->delay($delay);
來延遲任務(wù)執(zhí)行。dispatch(new App\Jobs\YourJob())->priority($priority);
來設(shè)置任務(wù)的優(yōu)先級。dispatch(new App\Jobs\YourJob())->tries($tries);
來設(shè)置任務(wù)嘗試執(zhí)行的次數(shù)。dispatch(new App\Jobs\YourJob())->concurrency($concurrency);
來限制任務(wù)并發(fā)數(shù)。dispatch(new App\Jobs\JobA())->then(function ($job) { dispatch(new App\Jobs\JobB()); });
來實現(xiàn)任務(wù)鏈。dispatch(new App\Jobs\YourJob())->cancel();
來取消任務(wù)。dispatch(new App\Jobs\YourJob())->status($status);
來設(shè)置任務(wù)狀態(tài)。dispatch(new App\Jobs\YourJob())->log($message);
來記錄任務(wù)日志。