| 1234567891011121314151617181920212223242526272829303132 |
- <?php
- namespace MGModule\DNSManager2\mgLibs\custom\cache;
- class FileCache implements CacheInterface {
- private $name;
-
- public function __construct($cache_name) {
- $this->name = __DIR__ . DIRECTORY_SEPARATOR . 'storage' . DIRECTORY_SEPARATOR . $cache_name;
- }
- public function exist() {
- return file_exists($this->name);
- }
- public function get() {
- return unserialize(@file_get_contents($this->name));
- }
- public function remove() {
- @unlink($this->name);
- }
- public function save($data) {
- try{
- $data = serialize($data);
- } catch (\Exception $ex) {
- $data = serialize(\MGModule\DNSManager2\mgLibs\custom\helpers\SerializeXMLObject::getInstance($data)->refactor());
- }
- @file_put_contents($this->name, $data);
- }
- }
|