Get a [KeyValueStore => array of cache keys] map (SplObjectStorage) for
multiple cache keys.

@param array $keys

@return SplObjectStorage
961770
protected function getShards(array $keys)
    {
        $shards = new SplObjectStorage();

        foreach ($keys as $key) {
            $shard = $this->getShard($key);
            if (!isset($shards[$shard])) {
                $shards[$shard] = array();
            }

            $shards[$shard] = array_merge($shards[$shard], array($key));
        }

        return $shards;
    }
440009
public function only(array $keys)
    {
        return $this->pipe(function ($values) use ($keys) {
            $result = Result::success();

            foreach ($values as $key => $_) {
                if (in_array($key, $keys)) {
                    continue;
                }

                return $result->concat(
                    Result::failure("contains '$key'")
                );
            }

            return $result;
        });
    }
1350412
public function loadOld(array $keys)
    {
        $result = array();
        // Load the values from the web shop specific configuration.
        $configurationValues = $this->getSettings()->getSetting($this->configCode);
        $values = isset($configurationValues['acumulus_siel_module']) ? $configurationValues['acumulus_siel_module'] : array();
        foreach ($keys as $key) {
            if (array_key_exists($key, $values)) {
                $result[$key] = $values[$key];
            }
        }

        // Delete the value, this will only be used one more time: during
        // updating to 5.4.0.
        unset($configurationValues['acumulus_siel_module']);
        $this->getSettings()->editSetting('acumulus_siel', $configurationValues);

        return $result;
    }
326821
public static function getSubArrayFromArrayByKeys(array $array, array $keys)
    {
        $result = [];

        foreach ($keys as $key) {
            if (array_key_exists($key, $array)) {
                $result[$key] = $array[$key];
            }
        }

        return $result;
    }
1138226
public static function wrapMany(array $keys)
    {
        foreach ($keys as &$key) {
            $key = self::wrap($key);
        }

        return $keys;
    }
1287304
public function select(array $keys)
    {
        $list = [];
        foreach ($keys as $key) {
            if (isset($this->entries[$key])) {
                $list[$key] = $this->entries[$key];
            }
        }

        return $this->createFrom($list);
    }
932278
public function getMany($keys)
    {
        if (!is_array($keys))
            $keys = func_get_args();

        $newArray = array();

        foreach($keys as $key) {
            if (isset($_SESSION[$key])) {
                $newArray[$key] = $_SESSION[$key];
            }
        }

        return $newArray;
    }
1117324
public function clear(array $keys=null)
    {
        $keys = $keys === null ? $this->keys() : $keys;

        foreach ($keys as $key) {
            $this->offsetUnset($key);
        }

        return $this;
    }
965313
function getFromKeys(array $keys)
    {
        try {
            $c = $this->collection->find(
                [
                    'key'   => [ '$in' => array_values($keys) ],
                    'realm' => $this->getRealm(),
                ]
                , [ 'typeMap' => self::$typeMap ] // override typeMap option
            );

            foreach ($c as $d) {
                $key     = $d['key'];
                $val     = $this->getDataInterchange()->retrieveBackward( $d['value'] );

                parent::set($key, $val);
                yield $key => $val;
            }

        } catch (\Exception $e) {
            throw new exReadError($e->getMessage(), $e->getCode(), $e);
        }
    }
756511
protected function mapKeysToIds($keys): array
    {
        $this->assertIterable($keys, 'keys not iterable');

        $map = [];

        foreach ($keys as $key) {
            $id = $this->keyToId($key);
            $map[$id] = $key;
        }

        return $map;
    }
687152
public function getMultiple($keys)
	{
		$items = array();
		$success = false;
		$values = apc_fetch($keys, $success);

		if ($success && is_array($values))
		{
			foreach ($values as $key => $value)
			{
				// @todo - identify the value when a cache item is not found.
				$items[$key] = new Item($key);
				$items[$key]->setValue($value);
			}
		}

		return $items;
	}
576613
public function getMulti(array $keys)
    {
        $results = array();
        foreach ($keys as $key) {
            $results[$key] = $this->get($key);
        }
        return $results;
    }
627792
public function many(array $keys)
    {
        $prefixedKeys = array_map(function ($key) {
            return $this->prefix.$key;
        }, $keys);

        if ($this->onVersionThree) {
            $values = $this->memcached->getMulti($prefixedKeys, Memcached::GET_PRESERVE_ORDER);
        } else {
            $null = null;

            $values = $this->memcached->getMulti($prefixedKeys, $null, Memcached::GET_PRESERVE_ORDER);
        }

        if ($this->memcached->getResultCode() != 0) {
            return array_fill_keys($keys, null);
        }

        return array_combine($keys, $values);
    }
97475
protected function getValues($keys)
    {
        if (empty($keys)) {
            return [];
        }
        $query = new Query;
        $query->select(['id', 'data'])
            ->from($this->cacheTable)
            ->where(['id' => $keys])
            ->andWhere('([[expire]] = 0 OR [[expire]] > ' . time() . ')');

        if ($this->db->enableQueryCache) {
            $this->db->enableQueryCache = false;
            $rows = $query->createCommand($this->db)->queryAll();
            $this->db->enableQueryCache = true;
        } else {
            $rows = $query->createCommand($this->db)->queryAll();
        }

        $results = [];
        foreach ($keys as $key) {
            $results[$key] = false;
        }
        foreach ($rows as $row) {
            $results[$row['id']] = $row['data'];
        }

        return $results;
    }
538895
public function getTextFromArray(array $keys = [])
    {
        $values = [];
        foreach ($keys as $key) {
            $values[$key] = $this->getText($key);
        }
        return $values;
    }
1093076
public function many(array $keys)
    {
        $return = [];

        $prefixedKeys = array_map(function ($key) {
            return $this->prefix . $key;
        }, $keys);

        $values = $this->connection()->mGet($prefixedKeys);

        foreach ($values as $index => $value) {
            $return[$keys[$index]] = is_numeric($value) ? $value : unserialize($value);
        }

        return $return;
    }
147362
public static function createFromKeys(array $keys): self
    {
        $keys = \array_filter($keys, function () {
            return true;
        });
        foreach ($keys as $k => $v) {
            if ($v->has('kid')) {
                unset($keys[$k]);
                $keys[$v->get('kid')] = $v;
            }
        }

        return new self($keys);
    }