function drush_get_cid

8.0.x cache.inc drush_get_cid($prefix, $contexts = array(), $params = array())
6.x cache.inc drush_get_cid($prefix, $contexts = array(), $params = array())
7.x cache.inc drush_get_cid($prefix, $contexts = array(), $params = array())
5.x cache.inc drush_get_cid($prefix, $contexts = array(), $params = array())
master cache.inc drush_get_cid($prefix, $contexts = array(), $params = array())

Create a cache id from a given prefix, contexts, and additional parameters.

Parameters

prefix: A human readable cid prefix that will not be hashed.

contexts: Array of drush contexts that will be used to build a unique hash.

params: Array of any addition parameters to be hashed.

Return value

A cache id string.

7 calls to drush_get_cid()
drush_cid_install_profile in includes/drupal.inc
Build a cache id to store the install_profile for a given site.
drush_complete_cache_cid in includes/complete.inc
Generate a cache id.
drush_sandwich_make_me_a_sandwich in examples/sandwich.drush.inc
Implements drush_hook_COMMAND().
drush_sandwich_sandwiches_served in examples/sandwich.drush.inc
Implements drush_hook_COMMAND().
drush_sitealias_cache_alias_by_path in includes/sitealias.inc
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.

... See full list

File

includes/cache.inc, line 186
Drush cache API

Code

function drush_get_cid($prefix, $contexts = array(), $params = array()) {
  $cid = array();

  foreach ($contexts as $context) {
    $c = drush_get_context($context);
    if (!empty($c)) {
      $cid[] = is_scalar($c) ? $c : serialize($c);
    }
  }

  foreach ($params as $param) {
    $cid[] = $param;
  }

  return DRUSH_VERSION . '-' . $prefix . '-' . md5(implode("", $cid));
}