当前位置: 首页>>代码示例>>PHP>>正文


PHP Queue::getName方法代码示例

本文整理汇总了PHP中Queue::getName方法的典型用法代码示例。如果您正苦于以下问题:PHP Queue::getName方法的具体用法?PHP Queue::getName怎么用?PHP Queue::getName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Queue的用法示例。


在下文中一共展示了Queue::getName方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: save

 public function save(Queue $queue)
 {
     if ($queue->getId()) {
         $query = $this->dbAdapter->query('UPDATE `queues` SET `name` = :name WHERE `id = :id`');
         $query->execute($queue->getArrayCopy());
     } else {
         $query = $this->dbAdapter->query("INSERT INTO `queues` (`name`) VALUES (:name)");
         $query->execute(['name' => $queue->getName()]);
         $queue->setId($this->dbAdapter->getDriver()->getLastGeneratedValue());
     }
     return $queue;
 }
开发者ID:dragonmantank,项目名称:dockerfordevs-app,代码行数:12,代码来源:QueueService.php

示例2: view

 public function view()
 {
     $this->assertLoggedIn();
     $this->set('area', 'queues');
     try {
         //how do we find them?
         if ($this->args('id')) {
             $q = new Queue($this->args('id'));
         } else {
             throw new Exception("Could not find that queue.");
         }
         //did we really get someone?
         if (!$q->isHydrated()) {
             throw new Exception("Could not find that queue.");
         }
         if (!$q->isMine()) {
             throw new Exception("You do not have permission to view this queue.");
         }
         $this->setTitle("View Queue - " . $q->getName());
         $this->set('queue', $q);
         $available = $q->getJobs('available', 'user_sort', 'ASC');
         $this->set('available', $available->getRange(0, 20));
         $this->set('available_count', $available->count());
         $taken = $q->getJobs('taken', 'user_sort', 'DESC');
         $this->set('taken', $taken->getRange(0, 20));
         $this->set('taken_count', $taken->count());
         $complete = $q->getJobs('complete', 'user_sort', 'DESC');
         $this->set('complete', $complete->getRange(0, 20));
         $this->set('complete_count', $complete->count());
         $qa = $q->getJobs('qa', 'finished_time', 'DESC');
         $this->set('qa', $qa->getRange(0, 20));
         $this->set('qa_count', $qa->count());
         $failure = $q->getJobs('failure', 'user_sort', 'DESC');
         $this->set('failure', $failure->getRange(0, 20));
         $this->set('failure_count', $failure->count());
         $this->set('stats', QueueStats::getStats($q));
         $bots = $q->getBots();
         $this->set('bots', $bots->getRange(0, 20));
         $this->set('bot_count', $bots->count());
         $this->set('errors', $q->getErrorLog()->getRange(0, 50));
     } catch (Exception $e) {
         $this->setTitle('View Queue - Error');
         $this->set('megaerror', $e->getMessage());
     }
 }
开发者ID:eric116,项目名称:BotQueue,代码行数:45,代码来源:queue.php

示例3: receiveQueueMessages

 /**
  * Select unselected messages from queue
  *
  * @param Queue $queue
  * @param int $max
  * @param int $timeout
  * @throws Exception
  * @return \ArrayObject
  */
 private function receiveQueueMessages(Queue $queue, $max, $timeout)
 {
     $messages = array();
     $microtime = microtime(true);
     // cache microtime
     $db = $this->getDb();
     $qid = $this->getQueueId($queue->getName());
     // start transaction handling
     try {
         if ($max > 0) {
             $db->beginTransaction();
             $sql = "SELECT *\n                        FROM message\n                        WHERE queue_id = :queue_id\n                        AND (handle IS NULL OR timeout+" . (int) $timeout . " < " . (int) $microtime . ")\n                        LIMIT " . $max;
             $stmt = $db->prepare($sql);
             $stmt->execute(array('queue_id' => $qid));
             foreach ($stmt->fetchAll() as $data) {
                 $data['handle'] = md5(uniqid(rand(), true));
                 $sql = "UPDATE message\n                            SET\n                                handle = :handle,\n                                timeout = :timeout\n                            WHERE\n                                message_id = :id\n                                AND (handle IS NULL OR timeout+" . (int) $timeout . " < " . (int) $microtime . ")";
                 $stmt = $db->prepare($sql);
                 $stmt->bindParam(':handle', $data['handle'], \PDO::PARAM_STR);
                 $stmt->bindParam(':id', $data['message_id'], \PDO::PARAM_STR);
                 $stmt->bindValue(':timeout', $microtime);
                 $updated = $stmt->execute();
                 if ($updated) {
                     $messages[] = $data;
                 }
             }
             $db->commit();
         }
     } catch (\Exception $e) {
         $db->rollBack();
         throw $e;
     }
     $m = array();
     foreach ($messages as $msg) {
         $message = unserialize(base64_decode($msg['body']));
         if ($message instanceof Message) {
             $message->message_id = $msg['message_id'];
             $m[] = $message;
         }
     }
     return new \ArrayObject($m);
 }
开发者ID:kudm761,项目名称:php-queue-manager,代码行数:51,代码来源:Manager.php

示例4: testGetQueueName

 public function testGetQueueName()
 {
     $queueName = 'testQueueName-cz:xy';
     $queue = new Queue($this->redis, $queueName);
     $this->assertSame($queueName, $queue->getName());
 }
开发者ID:jannavratil,项目名称:php-rq,代码行数:6,代码来源:QueueTest.php

示例5: blockingDequeueEnqueue

 /**
  * Pops an element form the queue and atomically pushes into another queue
  * Blocks $timeout if there is no element to pop.
  *
  * @param Queue $target Popped element is pushed to this queue
  * @param int $timeout After $timeout seconds null is returned if queue is empty
  *
  * @return mixed element being popped and pushed, null on timeout
  *
  * @link http://redis.io/commands/brpoplpush
  */
 public function blockingDequeueEnqueue(Queue $target, $timeout)
 {
     return $this->client->brpoplpush($this->getName(), $target->getName(), $timeout);
 }
开发者ID:redtrine,项目名称:redtrine,代码行数:15,代码来源:Queue.php


注:本文中的Queue::getName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。