protected function _writeFile($content, $duration) {
		//$cacheTime = date('Y-m-d H:i:s', $timestamp);
		$now = time();
		if (!$duration) {
			$cacheTime = 0;
		} elseif (is_numeric($duration)) {
			$cacheTime = $now + $duration;
		} else {
			$cacheTime = strtotime($duration, $now);
		}

		$url = $this->request->here();
		$url = str_replace($this->request->base, '', $url);
		if ($url === '/') {
			$url = '_root';
		}

		$cache = $url;
		$prefix = Configure::read('Cache.prefix');
		if ($prefix) {
			$cache = $prefix . '_' . $url;
		}
		if ($url !== '_root') {
			$cache = Inflector::slug($cache);
		}
		if (empty($cache)) {
			return false;
		}

		$ext = $this->response->mapType($this->response->type());
		$content = $this->_compress($content, $ext);

		$cache = $cache . '.html';
		$content = '<!--cachetime:' . $cacheTime . ';ext:' . $ext . '-->' . $content;

		$folder = CACHE . 'views' . DS;
		if (Configure::read('debug') && !is_dir($folder)) {
			mkdir($folder, 0770, true);
		}
		$file = $folder . $cache;

		return file_put_contents($file, $content);
	}