function ApcuBackend::getMultiple

Same name in other branches
  1. 8.9.x core/lib/Drupal/Core/Cache/ApcuBackend.php \Drupal\Core\Cache\ApcuBackend::getMultiple()
  2. 10 core/lib/Drupal/Core/Cache/ApcuBackend.php \Drupal\Core\Cache\ApcuBackend::getMultiple()
  3. 11.x core/lib/Drupal/Core/Cache/ApcuBackend.php \Drupal\Core\Cache\ApcuBackend::getMultiple()

Overrides CacheBackendInterface::getMultiple

1 call to ApcuBackend::getMultiple()
ApcuBackend::invalidateMultiple in core/lib/Drupal/Core/Cache/ApcuBackend.php
Marks cache items as invalid.

File

core/lib/Drupal/Core/Cache/ApcuBackend.php, line 83

Class

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

Namespace

Drupal\Core\Cache

Code

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

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.