本文整理匯總了PHP中Resque::pop方法的典型用法代碼示例。如果您正苦於以下問題:PHP Resque::pop方法的具體用法?PHP Resque::pop怎麽用?PHP Resque::pop使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Resque
的用法示例。
在下文中一共展示了Resque::pop方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: reserve
/**
* Find the next available job from the specified queue and return an
* instance of Resque_Job for it.
*
* @param string $queue The name of the queue to check for a job in.
* @return null|object Null when there aren't any waiting jobs, instance of Resque_Job when a job was found.
*/
public static function reserve($queue)
{
$payload = Resque::pop($queue);
if (!is_array($payload)) {
return false;
}
return new Resque_Job($queue, $payload);
}
示例2: reserve
/**
* Find the next available job from the specified queue and return an
* instance of Resque_Job for it.
*
* @param string $queue The name of the queue to check for a job in.
* @return null|object Null when there aren't any waiting jobs, instance of Resque_Job when a job was found.
*/
public static function reserve($queue, $sm = null)
{
$payload = \Resque::pop($queue);
if (!is_array($payload)) {
return false;
}
return new ResqueJob($queue, $payload, $sm);
}
示例3: reserve
/**
* Find the next available job from the specified queue and return an
* instance of Resque_Job for it.
*
* @param string $queue The name of the queue to check for a job in.
* @return null|object Null when there aren't any waiting jobs, instance of Resque_Job when a job was found.
*/
public static function reserve($queue)
{
$payload = Resque::pop($queue);
if(!$payload) {
return;
}
return new Resque_Job($queue, $payload);
}
示例4: reserve
public static function reserve($queue)
{
$payload = Resque::pop($queue);
if (!is_array($payload)) {
return false;
}
if (isset($payload['closure'])) {
return new Resque_Job_Closure($queue, $payload);
} else {
return new Resque_Job_Class($queue, $payload);
}
}
示例5: testDequeueSeveralItemsWithArgs
public function testDequeueSeveralItemsWithArgs()
{
// GIVEN
$queue = 'jobs';
$args = array('foo' => 1, 'bar' => 10);
$removeArgs = array('foo' => 1, 'bar' => 2);
Resque::enqueue($queue, 'Test_Job_Dequeue9', $args);
Resque::enqueue($queue, 'Test_Job_Dequeue9', $removeArgs);
Resque::enqueue($queue, 'Test_Job_Dequeue9', $removeArgs);
$this->assertEquals(Resque::size($queue), 3);
// WHEN
$test = array('Test_Job_Dequeue9' => $removeArgs);
$removedItems = Resque::dequeue($queue, $test);
// THEN
$this->assertEquals($removedItems, 2);
$this->assertEquals(Resque::size($queue), 1);
$item = Resque::pop($queue);
$this->assertInternalType('array', $item['args']);
$this->assertEquals(10, $item['args'][0]['bar'], 'Wrong items were dequeued from queue!');
}