Index: includes/cache.inc =================================================================== --- includes/cache.inc (revision 4347) +++ includes/cache.inc (working copy) @@ -110,6 +110,8 @@ if (isset($data->data) && is_object($data->data)) { $cache[$view_name] = $data->data; } + // @todo: account for the case where an individual view is a cache + // miss, for example a manual clear or memcache eviction. } } // If missing index, rebuild the cache @@ -139,14 +141,16 @@ // Allow modules to modify default views before they are cached. drupal_alter('views_default_views', $cache); + // Cache each view. This must be done before the index is set to avoid + // a race condition when a proess gets a cache hit for the index, but a + // cache miss for the views themselves. + foreach ($cache as $name => $view) { + views_cache_set('views_default:' . $name, $view, TRUE); + } // Cache the index $index = array_keys($cache); views_cache_set('views_default_views_index', $index, TRUE); - // Cache each view - foreach ($cache as $name => $view) { - views_cache_set('views_default:' . $name, $view, TRUE); - } } }