function drush_cache_get

8.0.x cache.inc drush_cache_get($cid, $bin = 'default')
6.x cache.inc drush_cache_get($cid, $bin = 'default')
7.x cache.inc drush_cache_get($cid, $bin = 'default')
4.x cache.drush.inc drush_cache_get($cid = NULL, $bin = NULL)
5.x cache.inc drush_cache_get($cid, $bin = 'default')
master cache.inc drush_cache_get($cid, $bin = 'default')

Print an object returned from the cache.

Parameters

$cid: The cache ID of the object to fetch.

$bin: Optional parameter to specify a specific bin to fetch from.

File

commands/core/cache.drush.inc, line 98

Code

function drush_cache_get($cid = NULL, $bin = NULL) {
  if (!$cid) {
    drush_log(dt('You must specify a cache id to fetch.'), 'error');
    return;
  }

  if (!$bin) {
    $bin = 'cache';
  }

  $result = cache_get($cid, $bin);
  if (!empty($result)) {
    switch (drush_get_option('format', 'print_r')) {
      case 'export':
        drush_print(var_export($result, TRUE));
        return;
      case 'json':
        drush_print(drush_json_encode($result));
        return;
      case 'print_r':
      default:
        drush_print_r($result);
        return;
    }
  }
  else {
    drush_log(dt('The !cid object in the !bin cache bin was not found.', array('!cid' => $cid, '!bin' => $bin)), 'error');
  }
}