一个简单的文件缓存类 basePth = './'.$basePth; } /** * @desc 设置缓存 * @param $key * @param $con * @return bool|int */ public function setCache($key,$con){ $path = $this-getPath($key); return file_put_contents($path,$con); } /
basePth = './'.$basePth;
}
/**
* @desc 设置缓存
* @param $key
* @param $con
* @return bool|int
*/
public function setCache($key,$con){
$path = $this->getPath($key);
return file_put_contents($path,$con);
}
/**
* @desc 参数 time 表示cache的存活期,单位 秒,默认无限期
* @param $key
* @param int $time
* @return bool|string
*/
public function getCache($key,$time=0){
$path = $this->getPath($key);
if(!is_file($path))return false;
if($time&&filemtime($path)+$time
