function drush_get_cid

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

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


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

contexts: Optional. An array of drush contexts that will be used to build a unique hash.

params: Optional. An 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/
Build a cache id to store the install_profile for a given site.
drush_complete_cache_cid in includes/
Generate a cache id.
drush_sandwich_make_me_a_sandwich in examples/
Example drush command callback. This is where the action takes place.
drush_sandwich_sandwiches_served in examples/
Implementation of hook_drush_command() for sandwiches-served command.
drush_sitealias_cache_alias_by_path in includes/
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


includes/, line 180
Drush cache API


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