public function SearchApiViewsContentCache::get_cache_key in Search API 7
Overrides views_plugin_cache::get_cache_key().
Use the Search API query as the main source for the key. Note that in Views < 3.8, this method does not exist.
Overrides views_plugin_cache::get_cache_key
1 call to SearchApiViewsContentCache::get_cache_key()
- SearchApiViewsContentCache::get_results_key in contrib/
search_api_views/ includes/ plugin_content_cache.inc - Overrides views_plugin_cache::get_results_key().
File
- contrib/
search_api_views/ includes/ plugin_content_cache.inc, line 90 - Contains the SearchApiViewsContentCache class.
Class
- SearchApiViewsContentCache
- Plugin class for caching Search API views, with additional invalidation.
Code
public function get_cache_key($key_data = array()) {
global $user;
if (!isset($this->_results_key)) {
$query = $this
->getSearchApiQuery();
$query
->preExecute();
$key_data += array(
'query' => $query,
'roles' => array_keys($user->roles),
'super-user' => $user->uid == 1,
// special caching for super user.
'language' => $GLOBALS['language']->language,
'base_url' => $GLOBALS['base_url'],
'offset' => $this->view
->get_current_page() . '*' . $this->view
->get_items_per_page() . '+' . $this->view
->get_offset(),
);
// Not sure what gets passed in exposed_info, so better include it. All
// other parameters used in the parent method are already reflected in the
// Search API query object we use.
if (isset($_GET['exposed_info'])) {
$key_data['exposed_info'] = $_GET['exposed_info'];
}
}
$key = drupal_hash_base64(serialize($key_data));
return $key;
}