function drush_sitealias_cache_alias_by_path

8.0.x sitealias.inc drush_sitealias_cache_alias_by_path($alias_record)
6.x sitealias.inc drush_sitealias_cache_alias_by_path($alias_record)
7.x sitealias.inc drush_sitealias_cache_alias_by_path($alias_record)
master sitealias.inc drush_sitealias_cache_alias_by_path($alias_record)

Cache the specified alias in the alias path cache. The alias path cache creates a lookup from the site folder (/path/to/drupal/sites/default) to the provided alias record.

Only the name of the alias and the path to the file it is stored in is cached; when it is retrieved, it is loaded directly from the correct file.

2 calls to drush_sitealias_cache_alias_by_path()
drush_sitealias_lookup_alias_by_path in includes/sitealias.inc
Look for a defined alias that points to the specified site directory. The cache is tested first; if nothing is cached, then an exhaustive search is done for the specified site. If the exhaustive search returns a match, then it is cached.
_drush_sitealias_set_context_by_name in includes/sitealias.inc
Looks up the specified alias record and calls through to drush_sitealias_set_alias_context, below.

File

includes/sitealias.inc, line 2207
The site alias API.

Code

function drush_sitealias_cache_alias_by_path($alias_record) {
  if (!isset($alias_record['remote-host']) && isset($alias_record['root']) && isset($alias_record['uri']) && isset($alias_record['#name']) && isset($alias_record['#file'])) {
    $path = drush_sitealias_local_site_path($alias_record);
    if ($path) {
      $cid = drush_get_cid('alias-path-', array(), array($path));
      $alias_path_data = array(
        '#name' => $alias_record['#name'],
        '#file' => $alias_record['#file'],
      );
      drush_cache_set($cid, $alias_path_data);
    }
  }
}