public function views_plugin_cache::get_cache_key in Views (for Drupal 7) 7.3
Returns cache key.
Parameters
array $key_data: Additional data for cache segmentation and/or overrides for default segmentation.
Return value
string
2 calls to views_plugin_cache::get_cache_key()
File
- plugins/
views_plugin_cache.inc, line 338 - Definition of views_plugin_cache.
Class
- views_plugin_cache
- The base plugin to handle caching.
Code
public function get_cache_key($key_data = array()) {
global $user;
$key_data += array(
'roles' => array_keys($user->roles),
'super-user' => $user->uid == 1,
// special caching for super user.
'language' => $GLOBALS['language']->language,
'language_content' => $GLOBALS['language_content']->language,
'base_url' => $GLOBALS['base_url'],
'display_options' => $this->display->display_options,
);
if (empty($key_data['build_info'])) {
$build_info = $this->view->build_info;
foreach (array(
'query',
'count_query',
) as $index) {
// If the default query back-end is used generate SQL query strings from
// the query objects.
if ($build_info[$index] instanceof SelectQueryInterface) {
$query = $build_info[$index];
// If the query was not yet prepared, work on a clone and run
// preExecute().
if (!$query
->isPrepared()) {
$query = clone $build_info[$index];
$query
->preExecute();
}
$key_data['build_info'][$index] = array(
'sql' => (string) $query,
'arguments' => $query
->getArguments(),
);
}
}
}
return md5(serialize($key_data));
}