當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Resque::dequeue方法代碼示例

本文整理匯總了PHP中Resque::dequeue方法的典型用法代碼示例。如果您正苦於以下問題:PHP Resque::dequeue方法的具體用法?PHP Resque::dequeue怎麽用?PHP Resque::dequeue使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Resque的用法示例。


在下文中一共展示了Resque::dequeue方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: testDequeueItemWithiWrongArg

 public function testDequeueItemWithiWrongArg()
 {
     $queue = 'jobs';
     $arg = array('foo' => 1, 'bar' => 2);
     $arg2 = array('foo' => 2, 'bar' => 3);
     Resque::enqueue($queue, 'Test_Job_Dequeue');
     Resque::enqueue($queue, 'Test_Job_Dequeue', $arg);
     $this->assertEquals(Resque::size($queue), 2);
     $test = array('Test_Job_Dequeue' => $arg2);
     $this->assertEquals(Resque::dequeue($queue, $test), 0);
     $this->assertEquals(Resque::size($queue), 2);
 }
開發者ID:fahmiardi,項目名稱:php-resque,代碼行數:12,代碼來源:JobTest.php

示例2: die

<?php

if (empty($argv[1])) {
    die('Specify the name of a job to remove. e.g, php queue.php PHP_Job');
}
require __DIR__ . '/init.php';
date_default_timezone_set('GMT');
Resque::setBackend('127.0.0.1:6379');
// You can also use a DSN-style format:
//Resque::setBackend('redis://user:pass@127.0.0.1:6379');
//Resque::setBackend('redis://user:pass@a.host.name:3432/2');
Resque::dequeue($argv[1], $argv[2]);
echo "Success";
開發者ID:packageman,項目名稱:Php-resque,代碼行數:13,代碼來源:dequeue.php

示例3: testDequeueNonExistingItem2

 public function testDequeueNonExistingItem2()
 {
     $queue = 'jobs';
     Resque::enqueue($queue, 'Test_Job_Dequeue1');
     Resque::enqueue($queue, 'Test_Job_Dequeue2');
     Resque::enqueue($queue, 'Test_Job_Dequeue3');
     $this->assertEquals(Resque::size($queue), 3);
     $test = ['Test_Job_Dequeue4', 'Test_Job_Dequeue1'];
     $this->assertEquals(Resque::dequeue($queue, $test), 1);
     $this->assertEquals(Resque::size($queue), 2);
 }
開發者ID:HMAZonderland,項目名稱:php-resque-ex,代碼行數:11,代碼來源:JobTest.php

示例4: function

#!/usr/bin/php
<?php 
$config = ['require_services' => ['credis', 'psr_log'], 'git_urls' => ['https://github.com/chrisboulton/php-resque.git' => 'php_resque/'], 'pear' => ['php_resque/lib/' => 'Resque'], 'example' => function () {
    Resque::setBackend('localhost:6379');
    class My_Job
    {
        public function perform()
        {
            echo $this->args['name'];
        }
    }
    $statuses = [Resque_Job_Status::STATUS_WAITING => 'STATUS_WAITING', Resque_Job_Status::STATUS_RUNNING => 'STATUS_RUNNING', Resque_Job_Status::STATUS_FAILED => 'STATUS_FAILED', Resque_Job_Status::STATUS_COMPLETE => 'STATUS_COMPLETE'];
    $args = ['name' => 'Chris'];
    $token = Resque::enqueue('default', 'My_Job', $args, true);
    echo $token . PHP_EOL;
    $status = new Resque_Job_Status($token);
    echo $statuses[$status->get()] . PHP_EOL;
    Resque::dequeue('default', ['My_Job']);
    $status = new Resque_Job_Status($token);
    echo $statuses[$status->get()] . PHP_EOL;
}];
if ($return_config) {
    return $config;
}
require_once __DIR__ . '/_yf_autoloader.php';
new yf_autoloader($config);
開發者ID:yfix,項目名稱:yf,代碼行數:26,代碼來源:php_resque.php

示例5: deleteJob

 /**
  * Delete a job based on job id or key, if worker_class is empty then it'll remove
  * all jobs within the queue, if job_key is empty then it'll remove all jobs within
  * provided queue and worker_class
  *
  * @param string $queue The name of the queue to place the job in.
  * @param string $worker_class The name of the class that contains the code to execute the job.
  * @param string $job_key Job key
  * 
  * @return bool
  */
 public function deleteJob($queue, $worker_class = null, $job_key = null)
 {
     if (!empty($job_key) && !empty($worker_class)) {
         return Resque::dequeue($queue, array($worker_class => $job_key));
     } else {
         if (!empty($worker_class) && empty($job_key)) {
             return Resque::dequeue($queue, array($worker_class));
         } else {
             return Resque::dequeue($queue);
         }
     }
     // Remove all jobs inside queue
 }
開發者ID:xfstudio,項目名稱:yii-resque,代碼行數:24,代碼來源:RResque.php


注:本文中的Resque::dequeue方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。