当前位置: 首页>>代码示例>>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;未经允许,请勿转载。