本文整理汇总了PHP中Queue::getPheanstalk方法的典型用法代码示例。如果您正苦于以下问题:PHP Queue::getPheanstalk方法的具体用法?PHP Queue::getPheanstalk怎么用?PHP Queue::getPheanstalk使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Queue
的用法示例。
在下文中一共展示了Queue::getPheanstalk方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: fire
/**
* Execute the console command.
*
* @return void
*/
public function fire()
{
$queue = $this->argument('queue') ? $this->argument('queue') : \Config::get('queue.connections.beanstalkd.queue');
$this->info(sprintf('Clearing queue: %s', $queue));
$pheanstalk = \Queue::getPheanstalk();
$pheanstalk->useTube($queue);
$pheanstalk->watch($queue);
while ($job = $pheanstalk->reserve(0)) {
$pheanstalk->delete($job);
}
$this->info('Queue successfully cleared.');
}
示例2: fire
/**
* Execute the console command.
*
* @return void
*/
public function fire()
{
$queue = $this->argument('queue') ? $this->argument('queue') : \Config::get('queue.connections.beanstalkd.queue');
$this->info(sprintf('Clearing queue: %s', $queue));
$pheanstalk = \Queue::getPheanstalk();
$pheanstalk->useTube($queue);
$pheanstalk->watch($queue);
while ($job = $pheanstalk->reserve(0)) {
$pheanstalk->delete($job);
}
// Set the flag of the jobs
$jobs = \Job::all();
foreach ($jobs as $job) {
$job->added_to_queue = false;
$job->save();
}
$this->info('The Beankstalk queue has been cleared.');
}