Determine whether or not a view is cacheable. A view is not cacheable if there is some kind of user input or data required. For example, views that need to restrict to the 'current' user, or any views that require arguments or allow click-sorting are not cacheable.

3 calls to _views_is_cacheable()
views_get_view in ./views.module
This function loads a view by name or vid; if not found in db, it looks for a default view by that name.
views_update_12 in ./views.install
_views_save_view in ./views.module
Save a view to the database.

File

./views.module, line 796

Code

function _views_is_cacheable(&$view) {

  // views with arguments are immediately not cacheable.
  if (!empty($view->argument) || !empty($view->exposed_filter) || !empty($view->no_cache)) {
    return false;
  }
  views_load_cache();
  $filters = _views_get_filters();
  foreach ($view->filter as $i => $filter) {
    if ($filters[$filter['field']]['cacheable'] == 'no') {
      return false;
    }
  }
  foreach ($view->field as $i => $field) {
    if ($field['sortable']) {
      return false;
    }
  }
  return true;
}