You are here

function views_plugin_cache::get_results_key in Views (for Drupal 7) 6.2

Same name and namespace in other branches
  1. 6.3 plugins/views_plugin_cache.inc \views_plugin_cache::get_results_key()
  2. 7.3 plugins/views_plugin_cache.inc \views_plugin_cache::get_results_key()
2 calls to views_plugin_cache::get_results_key()
views_plugin_cache::cache_get in plugins/views_plugin_cache.inc
Retrieve data from the cache.
views_plugin_cache::cache_set in plugins/views_plugin_cache.inc
Save data to the cache.

File

plugins/views_plugin_cache.inc, line 260

Class

views_plugin_cache
The base plugin to handle caching.

Code

function get_results_key() {
  global $user;
  if (!isset($this->_results_key)) {
    $key_data = array(
      'build_info' => $this->view->build_info,
      'roles' => array_keys($user->roles),
      'super-user' => $user->uid == 1,
      // special caching for super user.
      'language' => $GLOBALS['language'],
    );
    foreach (array(
      'exposed_info',
      'page',
      'sort',
      'order',
    ) as $key) {
      if (isset($_GET[$key])) {
        $key_data[$key] = $_GET[$key];
      }
    }
    $this->_results_key = $this->view->name . ':' . $this->display->id . ':results:' . md5(serialize($key_data));
  }
  return $this->_results_key;
}