Example #1
0
 /**
  * Wrapper method to retrieve a PIFT job, using cache.
  *
  * We only cache a PIFT job is the status is "completed"
  *
  * @param $jobId
  * @param bool $reset
  * @return false|\mglaman\DrupalOrg\RawResponse|mixed
  */
 protected function getPiftJob($jobId, $reset = false)
 {
     $cid = implode(':', ['pift', $jobId]);
     $cached = $this->getCacheKey($cid);
     if ($cached === FALSE || $reset) {
         $this->debug("Cache MISS for {$cid}");
         $cached = $this->client->getPiftJob($jobId);
         $this->debug($cached->get('status'));
         if ($cached->get('status') == 'complete') {
             $this->setCacheKey($cid, $cached, 60);
         }
     } else {
         $this->debug("Cache HIT for {$cid}");
     }
     return $cached;
 }