function _views_fetch_data

3.x cache.inc _views_fetch_data($table = NULL, $move = TRUE, $reset = FALSE)
2.x cache.inc _views_fetch_data($table = NULL)

Fetch Views' data from the cache

1 call to _views_fetch_data()
views_fetch_data in ./views.module
Fetch Views' data from the cache

File

includes/cache.inc, line 26
cache.inc

Code

function _views_fetch_data($table = NULL) {
  static $cache = NULL;
  if (!isset($cache)) {
    $start = views_microtime();
    // NOTE: This happens whether we retrieve them from cache or otherwise.
    views_include_handlers();

    $data = views_cache_get('views_data', TRUE);
    if (!empty($data->data)) {
      $cache = $data->data;
    }

    if (empty($cache)) {
      $cache = module_invoke_all('views_data');
      foreach (module_implements('views_data_alter') as $module) {
        $function = $module . '_views_data_alter';
        $function($cache);
      }

      views_cache_set('views_data', $cache, TRUE);
    }

    vpr('Views data build time: ' . (views_microtime() - $start) * 1000 . ' ms');
  }

  if (!$table) {
    return $cache;
  }
  if (isset($cache[$table])) {
    return $cache[$table];
  }

  // Return an empty array if there is no match.
  return array();
}