function FileCache::getMultiple

8.0.x FileCache.php FileCache::getMultiple(&$cids)
7.x FileCache.php FileCache::getMultiple(&$cids)
master FileCache.php FileCache::getMultiple(&$cids)

Return 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

An array of the items successfully returned from cache indexed by cid.

Overrides CacheInterface::getMultiple

1 call to FileCache::getMultiple()
FileCache::get in lib/Drush/Cache/FileCache.php
Return data from the persistent cache.

File

lib/Drush/Cache/FileCache.php, line 42
Definition of Drush\Cache\FileCache.

Namespace

Drush\Cache

Class

FileCache
Default cache implementation.

Code

function getMultiple(&$cids) {
  try {
    $cache = array();
    foreach ($cids as $cid) {
      $filename = $this->getFilePath($cid);
      if (!file_exists($filename)) {
        throw new \Exception;
      }

      $item = $this->readFile($filename);
      if ($item) {
        $cache[$cid] = $item;
      }
    }
    $cids = array_diff($cids, array_keys($cache));
    return $cache;
  }
  catch (\Exception $e) {
    return array();
  }
}