本文整理汇总了PHP中Resque::later方法的典型用法代码示例。如果您正苦于以下问题:PHP Resque::later方法的具体用法?PHP Resque::later怎么用?PHP Resque::later使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Resque
的用法示例。
在下文中一共展示了Resque::later方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: enqueueJob
public function enqueueJob($delay, $job, array $data = array(), $queue = null)
{
return \Resque::later($delay, $job, $data, $queue);
}
示例2: array
$job = Resque::push('FailLong', array());
break;
case 'failexception':
$job = Resque::push('FailException', array());
break;
case 'failerror':
$job = Resque::push('FailError', array());
break;
case 'closure':
$job = Resque::push(function ($job) {
echo 'This is an inline job! #' . $job->getId() . PHP_EOL;
});
break;
case 'closure-delayed':
$job = Resque::later(mt_rand(0, 30), function ($job) {
echo 'This is a delayed inline job! #' . $job->getId() . PHP_EOL;
});
break;
}
}
if ($job) {
header('Location: ?id=' . $job->getId());
exit;
}
echo '<pre><h1><a href="?">php-resque</a></h1><ul>' . '<li><a href="?action=reset">Reset</a></li>' . '<li><a href="?action=push">Push new job</a></li>' . '<li><a href="?action=delayed">Delayed job</a></li>' . '<li><a href="?action=delayedat">Delayed job in 2 mins</a></li>' . '<li><a href="?action=longrunning">Long running job</a></li>' . '<li><a href="?action=faillong">Fail due to running too long</a></li>' . '<li><a href="?action=failnoclass">Fail due to no class being found</a></li>' . '<li><a href="?action=failexception">Fail due to exception</a></li>' . '<li><a href="?action=failerror">Fail due to fatal error</a></li>' . '<li><a href="?action=closure">Push closure</a></li>' . '<li><a href="?action=closure-delayed">Delayed closure</a></li>' . '</ul>';
$rep = 150;
echo str_repeat('=', $rep) . PHP_EOL;
echo 'Resque stats: ' . json_encode(Resque::stats()) . PHP_EOL;
echo 'Hosts: ' . json_encode(Resque\Redis::instance()->smembers('hosts')) . PHP_EOL;
echo 'Workers: ' . json_encode(Resque\Redis::instance()->smembers('workers')) . PHP_EOL;
echo 'Queues: ' . json_encode(Resque\Redis::instance()->smembers('queues')) . PHP_EOL;