You are here

function domain_views_plugin_cache_time::get_output_key in Domain Access 6.2

File

domain_views/includes/domain_views_plugin_cache_time.inc, line 52
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_output_key() {

  /**
   * Create an md5 hashed key including the current domain
   * to use as the cache key for caching the views output.
   */
  global $user;
  global $_domain;
  if (!isset($this->_output_key)) {
    $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'],
      'language' => $GLOBALS['language'],
      'domain' => $_domain['domain_id'],
    );

    // Match the results key.
    $this->_output_key = $this->view->name . ':' . $this->display->id . ':output:' . md5(serialize($key_data));
  }
  return $this->_output_key;
}