You are here

public function CacheProvider::fetchMultiple in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/doctrine/cache/lib/Doctrine/Common/Cache/CacheProvider.php \Doctrine\Common\Cache\CacheProvider::fetchMultiple()

Returns an associative array of values for keys is found in cache.

Parameters

string[] $keys Array of keys to retrieve from cache:

Return value

mixed[] Array of retrieved values, indexed by the specified keys. Values that couldn't be retrieved are not contained in this array.

Overrides MultiGetCache::fetchMultiple

File

vendor/doctrine/cache/lib/Doctrine/Common/Cache/CacheProvider.php, line 84

Class

CacheProvider
Base class for cache provider implementations.

Namespace

Doctrine\Common\Cache

Code

public function fetchMultiple(array $keys) {

  // note: the array_combine() is in place to keep an association between our $keys and the $namespacedKeys
  $namespacedKeys = array_combine($keys, array_map(array(
    $this,
    'getNamespacedId',
  ), $keys));
  $items = $this
    ->doFetchMultiple($namespacedKeys);
  $foundItems = array();

  // no internal array function supports this sort of mapping: needs to be iterative
  // this filters and combines keys in one pass
  foreach ($namespacedKeys as $requestedKey => $namespacedKey) {
    if (isset($items[$namespacedKey])) {
      $foundItems[$requestedKey] = $items[$namespacedKey];
    }
  }
  return $foundItems;
}