You are here

function drupal_cache_system_paths in Redis 7.2

Same name and namespace in other branches
  1. 7.3 redis.path.inc \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().

File

./redis.path.inc, line 199
Drupal default includes/path.inc file copy which only differs in:

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);
    }
  }
}