src/Psr16Manager.php
public function getMultiple(array $keys, $default = null)
    {
        $keyMaps = [];

        $values = static::$handler->getMultiple(
            (new Collection($keys))->map(
                // 回调
                function ($value, $key) use ($keyMaps) {
                    $keyOri = is_string($key) ? $key : $value;
                    $keyNormalized = $this->normalized($keyOri);

                    $keyMaps[$keyNormalized] = $keyOri;

                    return $keyNormalized;
                }
            )->values()->all()
        );

        $values = (new Collection($values))->mapWithKeys(
            function ($value, $key) use ($keys, $default, $keyMaps) {
                $keyOri = $keyMaps[$key];
                // If we could not find the cache value, we will get
                // the default value for this cache value. This default could be a callback
                // so we will execute the value function which will resolve it if needed.
                if (is_null($value)) {
                    // 如果keys自带有默认值
                    if (isset($keys[$keyOri])) {
                        $keyDefault = $keys[$keyOri];

                        $value = is_callable($keyDefault)
                            ? $keyDefault() : $keyDefault;
                    }

                    if (!is_null($default)) {
                        $value = is_callable($default)
                            ? $default($keyOri) : $default;
                    }
                }

                return [$keyOri => $value];
            }
        )->all();

        if (static::hasMacro()) {
            $values = $this->runMacro('getAfter', [$values, $keys, true]);
        }

        return $values;
    }
public function getMultiple(array $keys, $default = null)
    {
        $keyMaps = [];

        $values = static::$handler->getMultiple(
            (new Collection($keys))->map(
                // 回调
                function ($value, $key) use ($keyMaps) {
                    $keyOri = is_string($key) ? $key : $value;
                    $keyNormalized = $this->normalized($keyOri);

                    $keyMaps[$keyNormalized] = $keyOri;

                    return $keyNormalized;
                }
            )->values()->all()
        );

        $values = (new Collection($values))->mapWithKeys(
            function ($value, $key) use ($keys, $default, $keyMaps) {
                $keyOri = $keyMaps[$key];
                // If we could not find the cache value, we will get
                // the default value for this cache value. This default could be a callback
                // so we will execute the value function which will resolve it if needed.
                if (is_null($value)) {
                    // 如果keys自带有默认值
                    if (isset($keys[$keyOri])) {
                        $keyDefault = $keys[$keyOri];

                        $value = is_callable($keyDefault)
                            ? $keyDefault() : $keyDefault;
                    }

                    if (!is_null($default)) {
                        $value = is_callable($default)
                            ? $default($keyOri) : $default;
                    }
                }

                return [$keyOri => $value];
            }
        )->all();

        if (static::hasMacro()) {
            $values = $this->runMacro('getAfter', [$values, $keys, true]);
        }

        return $values;
    }
Obtains multiple cache items by their unique keys.

@param array $keys    a list of keys that can obtained in a single operation
@param mixed $default default value to return for keys that do not exist

@return iterable A list of key => value pairs.
Cache keys that do not exist or are stale will have $default as value.

@throws \Psr\SimpleCache\InvalidArgumentException
MUST be thrown if $keys is neither an array nor a Traversable,
or if any of the $keys are not a legal value