You are here

public function CachePluginBase::generateOutputKey in Views (for Drupal 7) 8.3

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 lib/Drupal/views/Plugin/views/cache/CachePluginBase.php
Retrieve data from the cache.
CachePluginBase::cache_set in lib/Drupal/views/Plugin/views/cache/CachePluginBase.php
Save data to the cache.

File

lib/Drupal/views/Plugin/views/cache/CachePluginBase.php, line 339
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->name . ':' . $this->displayHandler->display['id'] . ':output:' . md5(serialize($key_data));
  }
  return $this->outputKey;
}