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 any additional parameters necessary.

Parameters

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.

2 calls to drush_get_cid()
drush_complete_cache_cid in includes/complete.inc
Generate a cache id.
_drush_add_commandfiles in includes/command.inc

File

includes/cache.inc, line 179
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));
}