phpCache 更新至0.11

二 1st, 2010

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);
		}
}
?>
标签: , ,
  1. countmeon
    二 1st, 201013:24

    越来越专业了~~

  2. 仁心博客
    二 3rd, 201014:51

    技术贴…………

  3. mqycn
    二 4th, 201011:32

    都是些小东西啊,各位见笑了

  4. blazeq
    二 10th, 201014:15

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

  5. countmeon
    二 20th, 201010:23

    呵呵 新年快乐, 我过年回来啦。

  6. mqycn
    三 6th, 201018:08

    恩。你说的国内cn域名吧,不用换,只要正规的就没事,反正什么资料都有

  7. mqycn
    三 6th, 201018:08

    呵呵,回来的很早啊~我现在刚回来