public function allowCache(ResponseInterface $response, $type = 'private', $maxAge = null, $mustRevalidate = false)
    {
        if (!in_array($type, ['private', 'public'])) {
            throw new InvalidArgumentException('Invalid Cache-Control type. Must be "public" or "private".');
        }
        $headerValue = $type;
        if ($maxAge || is_integer($maxAge)) {
            if (!is_integer($maxAge)) {
                $maxAge = strtotime($maxAge);
            }
            $headerValue = $headerValue . ', max-age=' . $maxAge;
        }

        if ($mustRevalidate) {
            $headerValue = $headerValue . ", must-revalidate";
        }

        return $response->withHeader('Cache-Control', $headerValue);
    }