diff --git a/classes/cache/CacheFile.class.php b/classes/cache/CacheFile.class.php index 5942960f9..71815d06d 100644 --- a/classes/cache/CacheFile.class.php +++ b/classes/cache/CacheFile.class.php @@ -6,7 +6,7 @@ * * Filedisk Cache Handler * - * @author NAVER (developers@xpressengine.com) + * @author NAVER (developers@xpressengine.com) */ class CacheFile extends CacheBase { @@ -78,10 +78,10 @@ class CacheFile extends CacheBase $content[] = 'if(!defined(\'__XE__\')) { exit(); }'; $content[] = 'return \'' . addslashes(serialize($obj)) . '\';'; FileHandler::writeFile($cache_file, implode(PHP_EOL, $content)); - if(function_exists('opcache_invalidate')) - { - @opcache_invalidate($cache_file, true); - } + if(function_exists('opcache_invalidate')) + { + @opcache_invalidate($cache_file, true); + } } /** @@ -94,15 +94,15 @@ class CacheFile extends CacheBase function isValid($key, $modified_time = 0) { $cache_file = $this->getCacheFileName($key); - + if(file_exists($cache_file)) { - if($modified_time > 0 && filemtime($cache_file) < $modified_timed) - { - FileHandler::removeFile($cache_file); - return false; - } - + if($modified_time > 0 && filemtime($cache_file) < $modified_time) + { + FileHandler::removeFile($cache_file); + return false; + } + return true; } @@ -118,19 +118,19 @@ class CacheFile extends CacheBase */ function get($key, $modified_time = 0) { - if(!$cache_file = FileHandler::exists($this->getCacheFileName($key))) - { - return false; - } - - if($modified_time > 0 && filemtime($cache_file) < $modified_timed) + if(!$cache_file = FileHandler::exists($this->getCacheFileName($key))) { - FileHandler::removeFile($cache_file); return false; } - $content = include($cache_file); - + if($modified_time > 0 && filemtime($cache_file) < $modified_time) + { + FileHandler::removeFile($cache_file); + return false; + } + + $content = include($cache_file); + return unserialize(stripslashes($content)); } @@ -143,10 +143,10 @@ class CacheFile extends CacheBase function _delete($_key) { $cache_file = $this->getCacheFileName($_key); - if(function_exists('opcache_invalidate')) - { - @opcache_invalidate($cache_file, true); - } + if(function_exists('opcache_invalidate')) + { + @opcache_invalidate($cache_file, true); + } FileHandler::removeFile($cache_file); }