protected function getCacheKey(RequestInterface $request, KeyValueHttpHeader $varyHeaders = null)
    {
        if (!$varyHeaders) {
            return hash('sha256', $request->getMethod().$request->getUri());
        }

        $cacheHeaders = [];

        foreach ($varyHeaders as $key => $value) {
            if ($request->hasHeader($key)) {
                $cacheHeaders[$key] = $request->getHeader($key);
            }
        }

        return hash('sha256', $request->getMethod().$request->getUri().json_encode($cacheHeaders));
    }