You are here

public function MemCacheDrupal::getMultiple in Memcache API and Integration 7

Implements DrupalCacheInterface::getMultiple().

Overrides DrupalCacheInterface::getMultiple

File

./memcache.inc, line 72

Class

MemCacheDrupal
Implementation of cache.inc with memcache logic included

Code

public function getMultiple(&$cids) {

  // Clean up.
  $this
    ->garbageCollection();
  $results = dmemcache_get_multi($cids, $this->bin, $this->memcache);
  foreach ($results as $cid => &$result) {
    if (!$this
      ->valid($cid, $result)) {

      // This object has expired, so don't return it.
      unset($results[$cid]);
    }
  }

  // Remove items from the referenced $cids array that we are returning,
  // per the comment in cache_get_multiple() in includes/cache.inc.
  $cids = array_diff($cids, array_keys($results));
  return $results;
}