phpCache 更新至0.11

phpCache,现在更新到了0.11。

2010-1-31 Vesion 0.11
修复了每次读取字符不能超过128KB的限制
去除了nocahce模式存储的文件的功能
增加了读取失败的错误提示符

有需要的朋友请到http://www.catseven.cn/phpCache/下载。

< ?php
	/*
	CatSeven phpCache Vesion 0.11
	
	======CopyRight======
	Home:http://www.catseven.cn/phpCache/
	Design:Miao Qiyuan[miaoqiyuan.cn]
	*/
	
	class cache404{
		public $K,$P,$V;
		public function __construct($URI,$P='blog',$Par='./404cache/'){
			$this->U = $URI;
			$this->K = md5($URI);
			$this->P = $P;
			$this->Par = $Par;
			$this->E = '.tmp_miaoqiyuan';
			$this->F = $this->Par . $this->P . '/' . $this->K . $this->E;
			$this->V = 'CatSeven phpCache Error.';
		}
		public function getHtml($u){
			return file_get_contents($u,NULL,NULL,-1,1000000);
		}
		public function getCache(){
			if(!!($fp=@fopen($this->F,'r'))){
				$html=fread($fp,102400);
			}else{
				if($html=$this->getHtml($this->U)){
					$this->addIndex();
					$fp=fopen($this->F,'w');
					fwrite($fp,$html);
				}else{
					$html=$this->V;
				}
			}
			if($fp)fclose($fp);
			return $html;
		}
		public function noCache(){
			if(!$html=$this->getHtml($this->U))$html=$this->V;
			return $html;
		}
		public function flushCache(){
			unlink($this->F);
		}
		public function addIndex(){
			$fpidx=fopen($this->Par . $this->P . '.rtf','a');
			fwrite($fpidx,$this->K . '	' . $this->U . "\n");
			fclose($fpidx);
		}
}
?>

phpCache 更新至0.11》上有7条评论

  1. blazeq

    难道开始转向php了?
    对了,问一下,现在中文域名的情况,你说换不换域名?万一以后不能用了怎么办?

发表评论

电子邮件地址不会被公开。 必填项已用*标注

This site uses Akismet to reduce spam. Learn how your comment data is processed.