示例#1
0
 /**
  * @param array $keys
  * @return array CacheItemInterface
  */
 protected function fetchMultiObjectsFromCache(array $keys)
 {
     $items = [];
     $initKeys = [];
     foreach ($keys as $key) {
         $initKeys[] = $this->transformKey($key);
     }
     $status = $this->cache->getMany($initKeys, $records);
     if ($status == \Aerospike::OK) {
         foreach ($records as $record) {
             $key = $record['key']['key'];
             $cacheItem = new CacheItem($key);
             if ($record['bins'][self::AEROSPIKE_BIN] !== null) {
                 $cacheItem->set($record['bins'][self::AEROSPIKE_BIN]);
             }
             $items[$key] = $cacheItem;
         }
     }
     return $items;
 }
示例#2
0
 /**
  * @param array $keys
  * @return array
  */
 protected function fetchMultiObjectsFromCache(array $keys)
 {
     $items = [];
     $result = $this->cache->getMulti($keys, $null, \Memcached::GET_PRESERVE_ORDER);
     foreach ($result as $key => $value) {
         $cacheItem = new CacheItem($key);
         if (false !== ($result = unserialize($this->cache->get($key)))) {
             $cacheItem->set($result);
         }
         $items[$key] = $cacheItem;
     }
     return $items;
 }