blpop() public static method

Pop an item off the end of the specified queues, using blocking list pop, decode it and return it.
public static blpop ( array $queues, integer $timeout ) : null | array
$queues array
$timeout integer
return null | array Decoded item from the queue.
コード例 #1
0
ファイル: Job.php プロジェクト: buptning/php-resque
 /**
  * Find the next available job from the specified queues using blocking list pop
  * and return an instance of Resque_Job for it.
  *
  * @param array             $queues
  * @param int               $timeout
  * @return null|object Null when there aren't any waiting jobs, instance of Resque_Job when a job was found.
  */
 public static function reserveBlocking(array $queues, $timeout = null)
 {
     $item = Resque::blpop($queues, $timeout);
     if (!is_array($item)) {
         return false;
     }
     return new Resque_Job($item['queue'], $item['payload']);
 }
コード例 #2
0
ファイル: Reserve.php プロジェクト: snikius/php-resque
 public static function reserveBlocking(array $queues, $timeout = null)
 {
     $item = Resque::blpop($queues, $timeout);
     if (!is_array($item)) {
         return false;
     }
     if (isset($item['payload']['closure'])) {
         return new Resque_Job_Closure($item['queue'], $item['payload']);
     } else {
         return new Resque_Job_Class($item['queue'], $item['payload']);
     }
 }