You are here

function MemcacheStorage::getMultiple in Memcache Storage 7

Implements DrupalCacheInterface::getMultiple().

Overrides DrupalCacheInterface::getMultiple

2 calls to MemcacheStorage::getMultiple()
MemcacheStorage::get in ./memcache_storage.inc
Implements DrupalCacheInterface::get().
MemcacheStoragePageCache::getMultiple in ./memcache_storage.page_cache.inc
Ovirrides MemcacheStorage::getMultiple().
1 method overrides MemcacheStorage::getMultiple()
MemcacheStoragePageCache::getMultiple in ./memcache_storage.page_cache.inc
Ovirrides MemcacheStorage::getMultiple().

File

./memcache_storage.inc, line 68
Provides class for memcached data handling.

Class

MemcacheStorage
Class handles memcached cache objects.

Code

function getMultiple(&$cids) {
  $data = MemcacheStorageAPI::getMultiple($cids, $this
    ->cacheBinName());

  // Build a new array with cached data using normal cache id.
  $cache = array();
  if (empty($data)) {
    return $cache;
  }
  foreach ($data as $item) {

    // Check expiration for every cache item recieved from memcached pool.
    if ($this
      ->validateItem($item)) {
      $cache[$item->cid] = $item;
    }
  }

  // Leave cache ids that was unable to get data from memcache.
  $cids = array_diff($cids, array_keys($cache));
  return $cache;
}