diff --git a/docs/simplesamlphp-automated_metadata.txt b/docs/simplesamlphp-automated_metadata.txt
index 8cfd4d763ee33026279bd03ef9c948bc533f41a8..c2d01b555aa204a97d012025c39aff08cdc265cb 100644
--- a/docs/simplesamlphp-automated_metadata.txt
+++ b/docs/simplesamlphp-automated_metadata.txt
@@ -224,4 +224,8 @@ In config.php:
 	),
 
 
+Metadata cacheDuration
+----------------------
+
+SAML metadata may supply a cacheDuration attribute which indicates the maxium time to cache metadata. Because this module is run from cron, it cannot influence how often it is run and enfore this attribute by itself. Take care that you run metarefresh from cron at least as often as the shortest cacheDuration in your metadata sources.
 
diff --git a/lib/SimpleSAML/Metadata/SAMLParser.php b/lib/SimpleSAML/Metadata/SAMLParser.php
index 62d37f32ffbf1531266df222b9682af59c4134a5..f5e089d5568d3ff767a4af6cd8bd129a37bca638 100644
--- a/lib/SimpleSAML/Metadata/SAMLParser.php
+++ b/lib/SimpleSAML/Metadata/SAMLParser.php
@@ -342,11 +342,8 @@ class SimpleSAML_Metadata_SAMLParser {
 	/**
 	 * Determine how long a given element can be cached.
 	 *
-	 * This function looks for the 'cacheDuration' and 'validUntil' attributes to determine
-	 * how long a given XML-element is valid. It returns this as na unix timestamp.
-	 *
-	 * If both the 'cacheDuration' and 'validUntil' attributes are present, the shorter of them
-	 * will be returned.
+	 * This function looks for the 'validUntil' attribute to determine
+	 * how long a given XML-element is valid. It returns this as a unix timestamp.
 	 *
 	 * @param mixed $element  The element we should determine the expiry time of.
 	 * @param int|NULL $maxExpireTime  The maximum expiration time.
@@ -354,22 +351,13 @@ class SimpleSAML_Metadata_SAMLParser {
 	 *              limit is set for the element.
 	 */
 	private static function getExpireTime($element, $maxExpireTime) {
+		/* validUntil may be NULL */
+		$expire = $element->validUntil;
 
-		if ($element->cacheDuration !== NULL) {
-			$expire = SimpleSAML_Utilities::parseDuration($element->cacheDuration, time());
-			if ($maxExpireTime !== NULL && $maxExpireTime < $expire) {
-				$expire = $maxExpireTime;
-			}
-		} else {
+		if ( $maxExpireTime !== NULL && ($expire === NULL || $maxExpireTime < $expire) ) {
 			$expire = $maxExpireTime;
 		}
 
-		if ($element->validUntil !== NULL) {
-			if ($expire === NULL || $expire > $element->validUntil) {
-				$expire = $element->validUntil;
-			}
-		}
-
 		return $expire;
 	}
 
diff --git a/modules/aggregator2/lib/EntitySource.php b/modules/aggregator2/lib/EntitySource.php
index e849840ab641e9aad38a58f66d8182f0d9aea569..854147dc23e2c1bcf5ef4523f059c4db790b6956 100644
--- a/modules/aggregator2/lib/EntitySource.php
+++ b/modules/aggregator2/lib/EntitySource.php
@@ -209,19 +209,6 @@ class sspmod_aggregator2_EntitySource {
 			$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);