function drupal_cache_system_paths

Cache system paths for a page.

Cache an array of the system paths available on each page. We assume that aliases will be needed for the majority of these paths during subsequent requests, and load them in a single query during drupal_lookup_path().

1 call to drupal_cache_system_paths()
drupal_page_footer in includes/common.inc
Performs end-of-request tasks.

File

includes/path.inc, line 203

Code

function drupal_cache_system_paths() {
    // Check if the system paths for this page were loaded from cache in this
    // request to avoid writing to cache on every request.
    $cache =& drupal_static('drupal_lookup_path', array());
    if (empty($cache['system_paths']) && !empty($cache['map'])) {
        // Generate a cache ID (cid) specifically for this page.
        $cid = current_path();
        // The static $map array used by drupal_lookup_path() includes all
        // system paths for the page request.
        if ($paths = current($cache['map'])) {
            $data = array_keys($paths);
            $expire = REQUEST_TIME + 60 * 60 * 24;
            cache_set($cid, $data, 'cache_path', $expire);
        }
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.