/**
  * Queue\Queue
  *
  * @param array $options
  */
 private function __construct(array $options = array())
 {
     Util::handleError();
     foreach ($options as $option) {
         $this->options = $option + $this->options;
         $this->options['distributed'] = $this->options['distributed'] == 0 ? false : true;
         $this->name = $this->options['queue'];
         $this->distributed = $this->options['distributed'];
         $this->client =& $this->options['client'];
         if (!$this->client) {
             $this->client = new \Redis();
             $ret = $this->client->pconnect($this->options['host'], $this->options['port']);
             if ($ret === true) {
                 $this->client->select($this->options['db']);
                 break;
             }
             Log::warn('connect to redis failed', 'ret:', $ret);
         }
     }
 }
 /**
  * 获取一个任务
  *
  * @return bool|Caster
  */
 private function getReadyJob()
 {
     $keyChip = $this->queue->name . ':' . Job::JOBS_TAB . ':' . $this->tube . ':';
     $timePort = Util::now();
     $this->expireActivate($keyChip, $timePort);
     if (!($id = $this->pop($keyChip . Job::STATE_READY, $timePort))) {
         return false;
     }
     if (!($job = Caster::reload($id))) {
         return false;
     }
     $this->client->hIncrBy($this->queue->name . ':' . Job::JOB_TAB . ':' . $id, 'retry_times', 1);
     $this->jobId = $id;
     $this->periodic = $this->client->hGet($this->queue->name . ':' . Job::JOB_TAB . ':' . $id, 'periodic');
     return $job;
 }