public function beforeDispatch(Event $event) {
		if (Configure::read('Cache.check') === false) {
			return null;
		}

		/** @var \Cake\Network\Request $request */
		$request = $event->data['request'];

		$url = $request->here();
		$url = str_replace($request->base, '', $url);
		$file = $this->getFile($url);

		if ($file === null) {
			return null;
		}

		$cacheContent = $this->extractCacheContent($file);
		$cacheInfo = $this->extractCacheInfo($cacheContent);
		$cacheTime = $cacheInfo['time'];

		if ($cacheTime < time() && $cacheTime != 0) {
			unlink($file);
			return null;
		}

		/** @var \Cake\Http\Response $response */
		$response = $event->data['response'];
		$event->stopPropagation();

		$response->modified(filemtime($file));
		if ($response->checkNotModified($request)) {
			return $response;
		}

		$pathSegments = explode('.', $file);
		$ext = array_pop($pathSegments);
		$this->_deliverCacheFile($request, $response, $file, $ext);
		return $response;
	}