存档

2010年2月 的存档

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 . [...]

二 1st, 2010 | Filed under PHP, Products(作品), Share(分享)
标签: , ,