diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/cache/CachePluginBase.php b/core/modules/views/lib/Drupal/views/Plugin/views/cache/CachePluginBase.php
index d6e1c45..15787a6 100644
--- a/core/modules/views/lib/Drupal/views/Plugin/views/cache/CachePluginBase.php
+++ b/core/modules/views/lib/Drupal/views/Plugin/views/cache/CachePluginBase.php
@@ -7,8 +7,8 @@
 
 namespace Drupal\views\Plugin\views\cache;
 
+use Drupal\Core\Cache\Cache;
 use Drupal\Core\Language\Language;
-use Drupal\views\ViewExecutable;
 use Drupal\Core\Cache\CacheBackendInterface;
 use Drupal\views\Plugin\views\PluginBase;
 use Drupal\Core\Database\Query\Select;
@@ -109,7 +109,6 @@ protected function cacheSetExpire($type) {
     return CacheBackendInterface::CACHE_PERMANENT;
   }
 
-
   /**
    * Save data to the cache.
    *
@@ -126,17 +125,16 @@ public function cacheSet($type) {
           'total_rows' => isset($this->view->total_rows) ? $this->view->total_rows : 0,
           'current_page' => $this->view->getCurrentPage(),
         );
-        cache($this->table)->set($this->generateResultsKey(), $data, $this->cacheSetExpire($type));
+        \Drupal::cache($this->table)->set($this->generateResultsKey(), $data, $this->cacheSetExpire($type), $this->getCacheTags());
         break;
       case 'output':
         $this->storage['output'] = $this->view->display_handler->output;
         $this->gatherHeaders();
-        cache($this->table)->set($this->generateOutputKey(), $this->storage, $this->cacheSetExpire($type));
+        \Drupal::cache($this->table)->set($this->generateOutputKey(), $this->storage, $this->cacheSetExpire($type), $this->getCacheTags());
         break;
     }
   }
 
-
   /**
    * Retrieve data from the cache.
    *
@@ -151,7 +149,7 @@ public function cacheGet($type) {
       case 'results':
         // Values to set: $view->result, $view->total_rows, $view->execute_time,
         // $view->current_page.
-        if ($cache = cache($this->table)->get($this->generateResultsKey())) {
+        if ($cache = \Drupal::cache($this->table)->get($this->generateResultsKey())) {
           if (!$cutoff || $cache->created > $cutoff) {
             $this->view->result = $cache->data['result'];
             $this->view->total_rows = $cache->data['total_rows'];
@@ -162,7 +160,7 @@ public function cacheGet($type) {
         }
         return FALSE;
       case 'output':
-        if ($cache = cache($this->table)->get($this->generateOutputKey())) {
+        if ($cache = \Drupal::cache($this->table)->get($this->generateOutputKey())) {
           if (!$cutoff || $cache->created > $cutoff) {
             $this->storage = $cache->data;
             $this->view->display_handler->output = $cache->data['output'];
@@ -181,7 +179,7 @@ public function cacheGet($type) {
    * to be sure that we catch everything. Maybe that's a bad idea.
    */
   public function cacheFlush() {
-    cache($this->table)->deleteTags(array($this->view->storage->id() => TRUE));
+    Cache::invalidateTags(array($this->view->storage->id() => TRUE));
   }
 
   /**
@@ -327,6 +325,33 @@ public function generateOutputKey() {
     return $this->outputKey;
   }
 
+  /**
+   * Gets an array of cache tags for the current view.
+   *
+   * @return array
+   *   An array fo cache tags based on the current view.
+   */
+  protected function getCacheTags() {
+    $tags = array($this->view->storage->id() => TRUE);
+    // Add an ENTIY_TYPE_view tag for each entity type used by this view.
+    foreach ($this->view->getEntityTypes() as $type) {
+      $tags[$type . '_view'] = TRUE;
+    }
+
+    // Collect entity IDs too if there are view results.
+    if (!empty($this->view->result)) {
+      foreach ($this->view->result as $result) {
+        $tags[$result->_entity->entityType()][] = $result->_entity->id();
+
+        foreach ($result->_relationship_entities as $entity) {
+          $tags[$entity->entityType()][] = $entity->id();
+        }
+      }
+    }
+
+    return $tags;
+  }
+
 }
 
 /**
diff --git a/core/modules/views/lib/Drupal/views/ViewExecutable.php b/core/modules/views/lib/Drupal/views/ViewExecutable.php
index d8236cf..70b06fb 100644
--- a/core/modules/views/lib/Drupal/views/ViewExecutable.php
+++ b/core/modules/views/lib/Drupal/views/ViewExecutable.php
@@ -2225,4 +2225,30 @@ public function buildThemeFunctions($hook) {
     return $themes;
   }
 
+  /**
+   * Returns an array of all entity types used by this view.
+   *
+   * @return array
+   *   An array of entity types.
+   */
+  public function getEntityTypes() {
+    // Initialize handlers so we will have any relationships
+    $this->initHandlers();
+    // Start with the base table.
+    $entity_types = array();
+    $views_data = Views::viewsData();
+
+    // Add the base table.
+    $base_table_data = $views_data->get($this->storage->get('base_table'));
+    $entity_types[] = $base_table_data['table']['entity type'];
+
+    // Include all relationships.
+    foreach ($this->relationship as $relationship) {
+      $table_data = $views_data->get($relationship->definition['base']);
+      $entity_types[] = $table_data['table']['entity type'];
+    }
+
+    return array_unique($entity_types);
+  }
+
 }
