original_string: 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);
  	}
code: 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);
  	}
code_tokens: 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 ) ; }
docstring: Write a cached version of the file
  
  @param string $content view content to write to a cache file.
  @param int|string $duration Duration to set for cache file.
  @return bool Success of caching view.
docstring_tokens: Write a cached version of the file