public function displayCache($config)
	{
		if ($cachedResponse = cache()->get($this->generateCacheName($config)))
		{
			$cachedResponse = unserialize($cachedResponse);
			if (! is_array($cachedResponse) || ! isset($cachedResponse['output']) || ! isset($cachedResponse['headers']))
			{
				throw new Exception('Error unserializing page cache');
			}

			$headers = $cachedResponse['headers'];
			$output  = $cachedResponse['output'];

			// Clear all default headers
			foreach ($this->response->getHeaders() as $key => $val)
			{
				$this->response->removeHeader($key);
			}

			// Set cached headers
			foreach ($headers as $name => $value)
			{
				$this->response->setHeader($name, $value);
			}

			$output = $this->displayPerformanceMetrics($output);
			$this->response->setBody($output);

			return $this->response;
		}

		return false;
	}
public function displayCache($config)
	{
		if ($cachedResponse = cache()->get($this->generateCacheName($config)))
		{
			$cachedResponse = unserialize($cachedResponse);
			if (! is_array($cachedResponse) || ! isset($cachedResponse['output']) || ! isset($cachedResponse['headers']))
			{
				throw new Exception('Error unserializing page cache');
			}

			$headers = $cachedResponse['headers'];
			$output  = $cachedResponse['output'];

			// Clear all default headers
			foreach ($this->response->getHeaders() as $key => $val)
			{
				$this->response->removeHeader($key);
			}

			// Set cached headers
			foreach ($headers as $name => $value)
			{
				$this->response->setHeader($name, $value);
			}

			$output = $this->displayPerformanceMetrics($output);
			$this->response->setBody($output);

			return $this->response;
		}

		return false;
	}
public function displayCache ( $ config ) { if ( $ cachedResponse = cache ( ) -> get ( $ this -> generateCacheName ( $ config ) ) ) { $ cachedResponse = unserialize ( $ cachedResponse ) ; if ( ! is_array ( $ cachedResponse ) || ! isset ( $ cachedResponse [ 'output' ] ) || ! isset ( $ cachedResponse [ 'headers' ] ) ) { throw new Exception ( 'Error unserializing page cache' ) ; } $ headers = $ cachedResponse [ 'headers' ] ; $ output = $ cachedResponse [ 'output' ] ; // Clear all default headers foreach ( $ this -> response -> getHeaders ( ) as $ key => $ val ) { $ this -> response -> removeHeader ( $ key ) ; } // Set cached headers foreach ( $ headers as $ name => $ value ) { $ this -> response -> setHeader ( $ name , $ value ) ; } $ output = $ this -> displayPerformanceMetrics ( $ output ) ; $ this -> response -> setBody ( $ output ) ; return $ this -> response ; } return false ; }
Determines if a response has been cached for the given URI.

@param \Config\Cache $config

@throws \Exception

@return boolean|\CodeIgniter\HTTP\ResponseInterface
Determines if a response has been cached for the given URI .