protected function checkCache(
        Response $response,
        string $e_tags,
        int $max_age
    ) {
        $result = $response;

        $cache_method = $this->cache_method;
        if (is_callable($cache_method)) {
            $hash = '"' . $cache_method(serialize($response->body)) . '"';

            if (strpos($e_tags, $hash) !== false) {
                $reuse_headers = Utils::arrayWhitelist(
                    $response->headers,
                    [
                        'Content-Location',
                    ]
                );

                $result = $this->prepareResponse();
                $result->status = HttpResponse::HTTP_NOT_MODIFIED;
                $result->headers = $reuse_headers;
            }

            $result->headers['ETag'] = $hash;
            $result->headers['Cache-Control'] = 'private, max-age=' . $max_age
                . ', must-revalidate';
        } else {
            $this->sendError(
                static::ERROR_INTERNAL_SERVER,
                "Router config 'cache_method' is invalid"
            );
        }

        return $result;
    }