1.20.x admin_bar.module admin_bar_cache_get($cid)

Retrieve a client-side cache hash from cache.

The hash cache is consulted more than once per request; we therefore cache the results statically to avoid multiple database requests.

This should only be used for client-side cache hashes. Use cache_menu for administration bar content.

Parameters

$cid: The cache ID of the data to retrieve.

File

modules/admin_bar/admin_bar.module, line 294
Render an administrative bar as a dropdown menu at the top of the window.

Code

function admin_bar_cache_get($cid) {
  $cache = &backdrop_static(__FUNCTION__, array());

  if (!array_key_exists($cid, $cache)) {
    $cache[$cid] = cache('admin_bar')->get($cid);
    if ($cache[$cid] && isset($cache[$cid]->data)) {
      $cache[$cid] = $cache[$cid]->data;
    }
  }

  return $cache[$cid];
}