diff --git a/core/core.services.yml b/core/core.services.yml
index 53a2725..23de49e 100644
--- a/core/core.services.yml
+++ b/core/core.services.yml
@@ -67,6 +67,11 @@ services:
       - [setContainer, ['@service_container']]
     tags:
       - { name: cache.context }
+  cache_context.is_admin_route:
+    class: Drupal\Core\Cache\IsAdminRouteCacheContext
+    arguments: ['@router.admin_context']
+    tags:
+      - { name: cache.context}
 
   # Complex cache contexts, that may be calculated from a combination of
   # multiple aspects of the request context plus additional logic. Hence they
@@ -1284,7 +1289,7 @@ services:
     arguments: ['@library.discovery.collector', '@module_handler']
   library.discovery.collector:
     class: Drupal\Core\Asset\LibraryDiscoveryCollector
-    arguments: ['@cache.discovery', '@lock', '@library.discovery.parser']
+    arguments: ['@cache.discovery', '@lock', '@library.discovery.parser', '@cache_contexts']
     tags:
       - { name: needs_destruction }
   library.discovery.parser:
diff --git a/core/lib/Drupal/Core/Asset/LibraryDiscoveryCollector.php b/core/lib/Drupal/Core/Asset/LibraryDiscoveryCollector.php
index dfac4fa..965ec9b 100644
--- a/core/lib/Drupal/Core/Asset/LibraryDiscoveryCollector.php
+++ b/core/lib/Drupal/Core/Asset/LibraryDiscoveryCollector.php
@@ -7,8 +7,10 @@
 
 namespace Drupal\Core\Asset;
 
+use Drupal\Core\Cache\Cache;
 use Drupal\Core\Cache\CacheCollector;
 use Drupal\Core\Cache\CacheBackendInterface;
+use Drupal\Core\Cache\CacheContexts;
 use Drupal\Core\Lock\LockBackendInterface;
 
 /**
@@ -24,6 +26,20 @@ class LibraryDiscoveryCollector extends CacheCollector {
   protected $cacheKey = 'library_info';
 
   /**
+   * The cache context keys.
+   *
+   * @var array
+   */
+  protected $cacheContextKeys = ['user.roles', 'is_admin_route'];
+
+  /**
+   * The cache tags.
+   *
+   * @var array
+   */
+  protected $tags = ['library_info'];
+
+  /**
    * The cache backend.
    *
    * @var \Drupal\Core\Cache\CacheBackendInterface
@@ -45,6 +61,13 @@ class LibraryDiscoveryCollector extends CacheCollector {
   protected $discoveryParser;
 
   /**
+   * The cache context service.
+   *
+   * @var \Drupal\Core\Cache\CacheContexts
+   */
+  protected $cacheContexts;
+
+  /**
    * Constructs a CacheCollector object.
    *
    * @param string $cid
@@ -56,8 +79,11 @@ class LibraryDiscoveryCollector extends CacheCollector {
    * @param \Drupal\Core\Asset\LibraryDiscoveryParser $discovery_parser
    *   The library discovery parser.
    */
-  public function __construct(CacheBackendInterface $cache, LockBackendInterface $lock, LibraryDiscoveryParser $discovery_parser) {
-    parent::__construct($this->cacheKey, $cache, $lock, array($this->cacheKey));
+  public function __construct(CacheBackendInterface $cache, LockBackendInterface $lock, LibraryDiscoveryParser $discovery_parser, CacheContexts $cache_contexts) {
+    Cache::validateTags($this->tags);
+    $this->cache = $cache;
+    $this->lock = $lock;
+    $this->cacheContexts = $cache_contexts;
 
     $this->discoveryParser = $discovery_parser;
   }
@@ -72,4 +98,16 @@ protected function resolveCacheMiss($key) {
     return $this->storage[$key];
   }
 
+  /**
+   * {@inheritdoc}
+   */
+  protected function getCid() {
+    if (!isset($this->cid)) {
+      $contexts = $this->cacheContexts->convertTokensToKeys($this->cacheContextKeys);
+      $this->cid = $this->cacheKey . ':' . implode(':', $contexts);
+    }
+
+    return $this->cid;
+  }
+
 }
diff --git a/core/lib/Drupal/Core/Cache/IsAdminRouteCacheContext.php b/core/lib/Drupal/Core/Cache/IsAdminRouteCacheContext.php
new file mode 100644
index 0000000..e87d2fe
--- /dev/null
+++ b/core/lib/Drupal/Core/Cache/IsAdminRouteCacheContext.php
@@ -0,0 +1,49 @@
+<?php
+
+/**
+ * @file
+ * Contains \Drupal\Core\Cache\IsAdminRouteCacheContext.
+ */
+
+namespace Drupal\Core\Cache;
+
+use Drupal\Core\Routing\AdminContext;
+
+/**
+ * Defines the IsAdminRouteCacheContext service, for admin route caching.
+ */
+class IsAdminRouteCacheContext implements CacheContextInterface {
+
+  /**
+   * The admin context service.
+   *
+   * @var \Drupal\Core\Routing\AdminContext
+   */
+  protected $adminContext;
+
+  /**
+   * Constructs a new UserRolesCacheContext service.
+   *
+   * @param \Drupal\Core\Session\AccountInterface $user
+   *   The current user.
+   */
+  public function __construct(AdminContext $admin_context) {
+    $this->adminContext = $admin_context;
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public static function getLabel() {
+    return t('Is admin route');
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function getContext() {
+    return 'admin_route.' . ($this->adminContext->isAdminRoute() ? '1' : '0');
+  }
+
+}
+
diff --git a/core/tests/Drupal/Tests/Core/Asset/LibraryDiscoveryCollectorTest.php b/core/tests/Drupal/Tests/Core/Asset/LibraryDiscoveryCollectorTest.php
index 5993669..245d8f3 100644
--- a/core/tests/Drupal/Tests/Core/Asset/LibraryDiscoveryCollectorTest.php
+++ b/core/tests/Drupal/Tests/Core/Asset/LibraryDiscoveryCollectorTest.php
@@ -34,6 +34,13 @@ class LibraryDiscoveryCollectorTest extends UnitTestCase {
   protected $libraryDiscoveryParser;
 
   /**
+   * The mock cache contexts object.
+   *
+   * @var \Drupal\Core\Cache\CacheContexts|\PHPUnit_Framework_MockObject_MockObject
+   */
+  protected $cacheContexts;
+
+  /**
    * The library discovery collector under test.
    *
    * @var \Drupal\Core\Asset\LibraryDiscoveryCollector
@@ -65,8 +72,15 @@ protected function setUp() {
     $this->libraryDiscoveryParser = $this->getMockBuilder('Drupal\Core\Asset\LibraryDiscoveryParser')
       ->disableOriginalConstructor()
       ->getMock();
+    $this->cacheContexts = $this->getMockBuilder('Drupal\Core\Cache\CacheContexts')
+      ->disableOriginalConstructor()
+      ->getMock();
+    $this->cacheContexts->expects($this->any())
+      ->method('convertTokensToKeys')
+      ->with(['library_info', 'cache_context.user.roles', 'cache_context.is_admin_route'])
+      ->will($this->returnValue(['library_info']));
 
-    $this->libraryDiscoveryCollector = new LibraryDiscoveryCollector($this->cache, $this->lock, $this->libraryDiscoveryParser);
+    $this->libraryDiscoveryCollector = new LibraryDiscoveryCollector($this->cache, $this->lock, $this->libraryDiscoveryParser, $this->cacheContexts);
   }
 
   /**
