protected function getCached(RequestInterface $request)
    {
        if (!$this->isSupportedMethod($request)) {
            return null;
        }

        $cacheKey = self::getKey($request);
        if (is_null($cachedContent = $this->cache->get($cacheKey))) {
            return null;
        }

        $cached = unserialize($cachedContent);
        foreach ($cached as $value) {
            if (is_null($value)) {
                return null;
            }
        }

        // rebuild response with cache entry : status, headers, body, protocol version, reason
        $response = new Response($cached[0], $cached[1], $cached[2], $cached[3], $cached[4]);

        $response->cached = true;

        // set ttl information only on debug mode
        if ($this->debug) {
            $response->cacheTtl = $this->cache->ttl($cacheKey);
        }

        return $response;
    }