diff --git a/core/lib/Drupal/Core/Path/AliasManager.php b/core/lib/Drupal/Core/Path/AliasManager.php
index 9fe0e2c8b29686e942670831ce43502ee38e56d3..c201e0b1b5d9253234e11d615740120b99e21894 100644
--- a/core/lib/Drupal/Core/Path/AliasManager.php
+++ b/core/lib/Drupal/Core/Path/AliasManager.php
@@ -145,10 +145,8 @@ public function writeCache() {
         }
       }
 
-      if (!empty($path_lookups)) {
-        $twenty_four_hours = 60 * 60 * 24;
-        $this->cache->set($this->cacheKey, $path_lookups, $this->getRequestTime() + $twenty_four_hours);
-      }
+      $twenty_four_hours = 60 * 60 * 24;
+      $this->cache->set($this->cacheKey, $path_lookups, $this->getRequestTime() + $twenty_four_hours);
     }
   }
 
@@ -175,7 +173,6 @@ public function getPathByAlias($alias, $langcode = NULL) {
     // Look for path in storage.
     if ($path = $this->storage->lookupPathSource($alias, $langcode)) {
       $this->lookupMap[$langcode][$path] = $alias;
-      $this->cacheNeedsWriting = TRUE;
       return $path;
     }
 
@@ -216,8 +213,13 @@ public function getAliasByPath($path, $langcode = NULL) {
       // happens if a cache key has been set.
       if ($this->preloadedPathLookups === FALSE) {
         $this->preloadedPathLookups = array();
-        if ($this->cacheKey && $cached = $this->cache->get($this->cacheKey)) {
-          $this->preloadedPathLookups = $cached->data;
+        if ($this->cacheKey) {
+          if ($cached = $this->cache->get($this->cacheKey)) {
+            $this->preloadedPathLookups = $cached->data;
+          }
+          else {
+            $this->cacheNeedsWriting = TRUE;
+          }
         }
       }
 
@@ -242,14 +244,12 @@ public function getAliasByPath($path, $langcode = NULL) {
     // Try to load alias from storage.
     if ($alias = $this->storage->lookupPathAlias($path, $langcode)) {
       $this->lookupMap[$langcode][$path] = $alias;
-      $this->cacheNeedsWriting = TRUE;
       return $alias;
     }
 
     // We can't record anything into $this->lookupMap because we didn't find any
     // aliases for this path. Thus cache to $this->noAlias.
     $this->noAlias[$langcode][$path] = TRUE;
-    $this->cacheNeedsWriting = TRUE;
     return $path;
   }
 
diff --git a/core/tests/Drupal/Tests/Core/Path/AliasManagerTest.php b/core/tests/Drupal/Tests/Core/Path/AliasManagerTest.php
index 01290c42e6fe0cc7fc1a7b637ce3f712c732496a..cc041ce6d7270522d87692d16357604b751d3e55 100644
--- a/core/tests/Drupal/Tests/Core/Path/AliasManagerTest.php
+++ b/core/tests/Drupal/Tests/Core/Path/AliasManagerTest.php
@@ -339,14 +339,10 @@ public function testGetAliasByPathCachedMissLanguage() {
     // Call it twice to test the static cache.
     $this->assertEquals($alias, $this->aliasManager->getAliasByPath($path));
 
-    // This needs to write out the cache.
-    $expected_new_cache = array(
-      $cached_language->getId() => array($path),
-      $language->getId() => array($path),
-    );
-    $this->cache->expects($this->once())
-      ->method('set')
-      ->with($this->cacheKey, $expected_new_cache, (int) $_SERVER['REQUEST_TIME'] + (60 * 60 * 24));
+    // There is already a cache entry, so this should not write out to the
+    // cache.
+    $this->cache->expects($this->never())
+      ->method('set');
     $this->aliasManager->writeCache();
   }
 
@@ -441,13 +437,10 @@ public function testGetAliasByPathUncachedMissNoAlias() {
     // Call it twice to test the static cache.
     $this->assertEquals($path, $this->aliasManager->getAliasByPath($path));
 
-    // This needs to write out the cache.
-    $expected_new_cache = array(
-      $language->getId() => array($cached_path, $path),
-    );
-    $this->cache->expects($this->once())
-      ->method('set')
-      ->with($this->cacheKey, $expected_new_cache, (int) $_SERVER['REQUEST_TIME'] + (60 * 60 * 24));
+    // There is already a cache entry, so this should not write out to the
+    // cache.
+    $this->cache->expects($this->never())
+      ->method('set');
     $this->aliasManager->writeCache();
   }
 
@@ -533,13 +526,10 @@ public function testGetAliasByPathUncachedMissWithAlias() {
     // Call it twice to test the static cache.
     $this->assertEquals($new_alias, $this->aliasManager->getAliasByPath($path));
 
-    // This needs to write out the cache.
-    $expected_new_cache = array(
-      $language->getId() => array($cached_path, $path, $cached_no_alias_path),
-    );
-    $this->cache->expects($this->once())
-      ->method('set')
-      ->with($this->cacheKey, $expected_new_cache, (int) $_SERVER['REQUEST_TIME'] + (60 * 60 * 24));
+    // There is already a cache entry, so this should not write out to the
+    // cache.
+    $this->cache->expects($this->never())
+      ->method('set');
     $this->aliasManager->writeCache();
   }