Beispiel #1
0
 /**
  * Attempt to update our cache file.
  */
 public function updateCache()
 {
     if ($this->updateAttempted) {
         return;
     }
     $this->updateAttempted = TRUE;
     $this->metadata = $this->downloadMetadata();
     if ($this->metadata === NULL) {
         return;
     }
     $expires = time() + 24 * 60 * 60;
     /* Default expires in one day. */
     if ($this->metadata->validUntil !== NULL && $this->metadata->validUntil < $expires) {
         $expires = $this->metadata->validUntil;
     }
     if ($this->metadata->cacheDuration !== NULL) {
         try {
             $durationTo = SimpleSAML_Utilities::parseDuration($this->metadata->cacheDuration);
         } catch (Exception $e) {
             SimpleSAML_Logger::warning($this->logLoc . 'Invalid cacheDuration in metadata from ' . var_export($this->url, TRUE) . ': ' . var_export($this->metadata->cacheDuration, TRUE));
             return;
         }
         if ($durationTo < $expires) {
             $expires = $durationTo;
         }
     }
     $metadataSerialized = serialize($this->metadata);
     $this->aggregator->addCacheItem($this->cacheId, $metadataSerialized, $expires, $this->cacheTag);
 }
 /**
  * Attempt to update our cache file.
  */
 public function updateCache()
 {
     if ($this->updateAttempted) {
         return;
     }
     $this->updateAttempted = TRUE;
     $this->metadata = $this->downloadMetadata();
     if ($this->metadata === NULL) {
         return;
     }
     $expires = time() + 24 * 60 * 60;
     // Default expires in one day
     if ($this->metadata->validUntil !== NULL && $this->metadata->validUntil < $expires) {
         $expires = $this->metadata->validUntil;
     }
     $metadataSerialized = serialize($this->metadata);
     $this->aggregator->addCacheItem($this->cacheId, $metadataSerialized, $expires, $this->cacheTag);
 }