Esempio n. 1
0
 /**
  * @param array $groupedUidList
  */
 public function push(array $groupedUidList)
 {
     array_walk($groupedUidList, function (array $uidList, $shardId) {
         if (count($uidList) === 0) {
             return;
         }
         $filePath = $this->getQueueFilePath($shardId);
         $fileQueue = new FileQueue($filePath);
         $fileQueue->push(implode(PHP_EOL, $uidList));
     });
 }
Esempio n. 2
0
 public function testMulti()
 {
     $msgList = [];
     for ($i = 0; $i < 10; $i++) {
         $msgList[] = 'queue_item_' . $i;
     }
     $queue = new FileQueue($this->dir);
     foreach ($msgList as $msg) {
         $ret = $queue->push($msg);
         static::assertTrue($ret);
     }
     $offset = 0;
     while ($msg = $queue->pop()) {
         static::assertEquals($msgList[$offset], $msg);
         $offset++;
     }
 }