query = $query; $this->cacheFile = md5($query); if($time!=null) $this->cacheTime = $time; } public function CacheCheck() { if($this->cacheEnable == false || ($this->cacheEnable == true && is_file($this->cachePath.$this->cacheFile) && filemtime($this->cachePath.$this->cacheFile) > (time() - $this->cacheTime))) { return true; } else { return false; } } public function CacheWrite($result) { if($this->cacheEnable != false) { $records = serialize($result); $fp = fopen($this->cachePath.$this->cacheFile, "w"); fputs($fp, $records); fclose($fp); } } public function CacheRead() { $records = unserialize(file_get_contents($this->cachePath.$this->cacheFile)); return $records; } } ?>