public function CachePluginBase::generateOutputKey

Calculates and sets a cache ID used for the output cache.

Return value

string The generated cache ID.

2 calls to CachePluginBase::generateOutputKey()
CachePluginBase::cacheGet in drupal/core/modules/views/lib/Drupal/views/Plugin/views/cache/CachePluginBase.php
Retrieve data from the cache.
CachePluginBase::cacheSet in drupal/core/modules/views/lib/Drupal/views/Plugin/views/cache/CachePluginBase.php
Save data to the cache.

File

drupal/core/modules/views/lib/Drupal/views/Plugin/views/cache/CachePluginBase.php, line 312
Definition of Drupal\views\Plugin\views\cache\CachePluginBase.

Class

CachePluginBase
The base plugin to handle caching.

Namespace

Drupal\views\Plugin\views\cache

Code

public function generateOutputKey() {
  global $user;
  if (!isset($this->outputKey)) {
    $key_data = array(
      'result' => $this->view->result,
      'roles' => $user->roles,
      'super-user' => $user->uid == 1,
      // special caching for super user.
      'theme' => $GLOBALS['theme'],
      'langcode' => language(Language::TYPE_INTERFACE)->langcode,
      'base_url' => $GLOBALS['base_url'],
    );
    $this->outputKey = $this->view->storage
      ->id() . ':' . $this->displayHandler->display['id'] . ':output:' . hash('sha256', serialize($key_data));
  }
  return $this->outputKey;
}