You are here

public function ApcuRawBackend::getMultiple in Supercache 2.0.x

Same name and namespace in other branches
  1. 8 src/Cache/ApcuRawBackend.php \Drupal\supercache\Cache\ApcuRawBackend::getMultiple()

Returns data from the persistent cache when given an array of cache IDs.

Parameters

array $cids: An array of cache IDs for the data to retrieve. This is passed by reference, and will have the IDs successfully returned from cache removed.

Return value

array An array of cache item objects indexed by cache ID.

Overrides CacheRawBackendInterface::getMultiple

See also

\Drupal\Core\Cache\CacheRawBackendInterface::get()

1 call to ApcuRawBackend::getMultiple()
ApcuRawBackend::counterGetMultiple in src/Cache/ApcuRawBackend.php
Get multiple counter values at once.

File

src/Cache/ApcuRawBackend.php, line 123
Contains \Drupal\supercache\Cache\ApcuRawBackend.

Class

ApcuRawBackend
Stores cache items in the Alternative PHP Cache User Cache (APCu).

Namespace

Drupal\supercache\Cache

Code

public function getMultiple(&$cids) {

  // Translate the requested cache item IDs to APCu keys.
  $map = array();
  foreach ($cids as $cid) {
    $map[$this
      ->getApcuKey($cid)] = $cid;
  }
  $result = apcu_fetch(array_keys($map));
  $cache = array();
  if ($result) {
    foreach ($result as $key => $item) {
      $item = $this
        ->prepareItem($key, $item);
      $cache[$map[$key]] = $item;
    }
  }
  unset($result);
  $cids = array_diff($cids, array_keys($cache));
  return $cache;
}