diff --git a/core/lib/Drupal/Core/DrupalKernel.php b/core/lib/Drupal/Core/DrupalKernel.php
index 3ccb2d7..eed6244 100644
--- a/core/lib/Drupal/Core/DrupalKernel.php
+++ b/core/lib/Drupal/Core/DrupalKernel.php
@@ -1001,16 +1001,32 @@ protected function initializeSettings(Request $request) {
       }
     }
 
-    // If the class loader is still the same, possibly upgrade to the APC class
-    // loader.
+    // If the class loader is still the same, possibly upgrade to
+    // an optimized class loader.
     if ($class_loader_class == get_class($this->classLoader)
-        && Settings::get('class_loader_auto_detect', TRUE)
-        && function_exists('apcu_fetch')) {
+        && Settings::get('class_loader_auto_detect', TRUE)) {
+      $classloaders = [
+        \Symfony\Component\ClassLoader\ApcClassLoader::class,
+        \Symfony\Component\ClassLoader\WinCacheClassLoader::class,
+        \Symfony\Component\ClassLoader\XcacheClassLoader::class,
+      ];
       $prefix = Settings::getApcuPrefix('class_loader', $this->root);
-      $apc_loader = new ApcClassLoader($prefix, $this->classLoader);
-      $this->classLoader->unregister();
-      $apc_loader->register();
-      $this->classLoader = $apc_loader;
+      $loader = NULL;
+      // Each one of these optimized loaders will verify that the
+      // required storage backends are available upon being instantiated
+      // and will throw an exception if not.
+      foreach ($classloaders as $loader_class) {
+        try {
+          $loader = new $loader_class($prefix, $this->classLoader);
+          break;
+        }
+        catch (\Exception $e) {}
+      }
+      if (!empty($loader)) {
+        $this->classLoader->unregister();
+        $loader->register();
+        $this->classLoader = $loader;
+      }
     }
   }
 
diff --git a/core/rebuild.php b/core/rebuild.php
index 4e69eab..da357ec 100644
--- a/core/rebuild.php
+++ b/core/rebuild.php
@@ -42,9 +42,17 @@
     ((REQUEST_TIME - $request->query->get('timestamp')) < 300) &&
     Crypt::hashEquals(Crypt::hmacBase64($request->query->get('timestamp'), Settings::get('hash_salt')), $request->query->get('token'))
   )) {
-  // Clear the APCu cache to ensure APCu class loader is reset.
-  if (function_exists('apcu_clear_cache')) {
-    apcu_clear_cache();
+  // Clear user cache for all major platforms.
+  $user_caches = [
+    'apc_clear_cache' => ['user'],
+    'apcu_clear_cache' => [],
+    'wincache_ucache_clear' => [],
+    'xcache_clear_cache' => [],
+  ];
+  foreach ($user_caches as $name => $args) {
+    if (is_callable($name)) {
+      call_user_func_array($name, $args);
+    }
   }
   drupal_rebuild($autoloader, $request);
   drupal_set_message('Cache rebuild complete.');
