. */ namespace Doctrine\ORM\Cache\Region; use Doctrine\ORM\Cache\Lock; use Doctrine\ORM\Cache\Region; use Doctrine\ORM\Cache\CacheKey; use Doctrine\ORM\Cache\CacheEntry; use Doctrine\Common\Cache\CacheProvider; use Doctrine\ORM\Cache\MultiGetRegion; use Doctrine\ORM\Cache\CollectionCacheEntry; /** * A cache region that enables the retrieval of multiple elements with one call * * @since 2.5 * @author Asmir Mustafic */ class DefaultMultiGetRegion extends DefaultRegion implements MultiGetRegion { /** * {@inheritdoc} */ public function getMulti(CollectionCacheEntry $collection) { $keysToRetrieve = array(); foreach ($collection->identifiers as $index => $key) { $keysToRetrieve[$index] = $this->name . '_' . $key->hash; } $items = $this->cache->fetchMultiple($keysToRetrieve); if (count($items) !== count($keysToRetrieve)) { return null; } $returnableItems = array(); foreach ($keysToRetrieve as $index => $key) { $returnableItems[$index] = $items[$key]; } return $returnableItems; } }