本文整理匯總了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;