function drush_complete_cache_cid

8.0.x complete.inc drush_complete_cache_cid($type, $command = NULL)
6.x complete.inc drush_complete_cache_cid($type, $command = NULL)
7.x complete.inc drush_complete_cache_cid($type, $command = NULL)
5.x complete.inc drush_complete_cache_cid($type, $command = NULL)
master complete.inc drush_complete_cache_cid($type, $command = NULL)

Generate a cache id.

Parameters

$type: The completion type.

$command: The command name (optional), if completions are command specific.

Return value

string Cache id.

3 calls to drush_complete_cache_cid()
drush_complete_cache_clear in includes/drush.inc
Clears completion caches.
drush_complete_cache_set in includes/complete.inc
Stores caches for completions.
drush_complete_get in includes/complete.inc
Retrieves from cache, or generates a listing of completion candidates of a specific type (and optionally, command).

File

includes/complete.inc, line 560
Provide completion output for shells.

Code

function drush_complete_cache_cid($type, $command = NULL) {
  // For per-site caches, we include the site root and uri/path in the cache id
  // hash. These are quick to determine, and prevents a bootstrap to site just
  // to get a validated root and URI. Because these are not validated, there is
  // the possibility of cache misses/ but they should be rare, since sites are
  // normally referred to the same way (e.g. a site alias, or using the current
  // directory), at least within a single command completion session.
  // We also static cache them, since we may get differing results after
  // bootstrap, which prevents the caches from being found on the next call.
  static $root, $site;
  if (empty($root)) {
    $root = drush_get_option(array('r', 'root'), drush_locate_root());
    $site = drush_get_option(array('l', 'uri'), drush_site_path());
  }
  return drush_get_cid('complete', array(), array($type, $command, $root, $site));
}