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::cache_get in drupal/core/modules/views/lib/Drupal/views/Plugin/views/cache/CachePluginBase.php
Retrieve data from the cache.
CachePluginBase::cache_set 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 326
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' => array_keys($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
      ->get('name') . ':' . $this->displayHandler->display['id'] . ':output:' . md5(serialize($key_data));
  }
  return $this->outputKey;
}