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);
}
}
崩坏星穹铁道可供交易的崇高客体成就如何达成 崩坏星穹铁道可供交易的崇高客体成就达成攻略
原神纳塔3个亮闪闪的贝壳收集位置攻略-原神纳塔3个亮闪闪的贝壳在哪里收集
崩坏星穹铁道雪国飘摇寒苦愁任务怎么做-崩坏星穹铁道雪国飘摇寒苦愁任务攻略
原神5.0下半卡池的基尼奇怎么培养-原神基尼奇培养攻略+突破材料(武器,天赋)
魔兽世界埃霍恩的冰霜之镰如何获得 魔兽世界埃霍恩的冰霜之镰获取详细攻略
归龙潮的长命锁潮品如何选择 归龙潮的长命锁潮品详情推荐