class Cache
{
protected $_cacheDir;
public function __construct()
{
$this->_cacheDir = "./cache";
}
public function setCacheDir($cacheDir)
{
if(empty($cacheDir)){
$this->_cacheDir = $this->_cacheDir;
}else{
$this->_cacheDir = $cacheDir;
}
}
public function getCache($name)
{
$file_path = $this->_cacheDir.'/namma_cache-'.$name;
if(!file_exists($file_path))
{
return false;
}
$handle = @fopen($file_path,'rb');
$data = @fread($handle,filesize($file_path));
return $this->unformatData($data);
@flose($handle);
}
public function setCache($name,$data)
{
$file_path = $this->_cacheDir.'/namma_cache-'.$name;
$data = $this->formatData($data);
$fp = fopen($file_path, 'w');
fwrite($fp,$data);
fclose($fp);
return $file_path;
}
public function formatData($data)
{
return serialize($data);
}
public function unformatData($data)
{
return unserialize($data);
}
}
模拟火车
模拟火车让你当回真正的火车司机,得先学会看信号灯、操作控制杆
可口的披萨美味的披萨
可口的披萨美味的披萨带您体验经营一家披萨店的乐趣。游戏画风温
定制虚拟偶像最新版
定制虚拟偶像最新版是一款超级经典有趣的日本模拟装扮类型的手游
病娇模拟器手机版正版(yandere simulator)
病娇模拟器最新版手游是一款萌妹二次元模拟游戏,玩家在游戏中可
停车场多人游戏最新版
停车场多人游戏对于喜欢停车手游的玩家是非常受欢迎的,游戏中你