function domain_views_plugin_cache_time::get_cache_key in Domain Views 7
Returns cache key.
Parameters
array $key_data: Additional data for cache segmentation and/or overrides for default segmentation.
Return value
string
Overrides views_plugin_cache::get_cache_key
See also
views_plugin_cache::get_cache_key()
2 calls to domain_views_plugin_cache_time::get_cache_key()
File
- includes/
domain_views_plugin_cache_time.inc, line 63 - Domain Views plugin that caches views on a per domain basis. This is necessary for views that filter on "current domain" (ex. SELECT * FROM {node} WHERE domain_source = current_domain) otherwise "current domain" will be cached.
Class
- domain_views_plugin_cache_time
- Cache plugin that provides caching on a per domain basis.
Code
function get_cache_key($key_data = array()) {
global $user;
global $_domain;
$key_data += array(
'roles' => array_keys($user->roles),
'super-user' => $user->uid == 1,
// special caching for super user.
'language' => $GLOBALS['language'],
'domain' => $_domain['domain_id'],
);
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 = clone $build_info[$index];
$query
->preExecute();
$key_data['build_info'][$index] = array(
'sql' => (string) $query,
'arguments' => $query
->getArguments(),
);
}
}
}
$key = md5(serialize($key_data));
return $key;
}