/** * @param $key * @param int $expires * * @return Cache\CacheInterface */ private static function _Factory($key, $expires = 7200){ if(self::$_Backend === null){ // Load the backend from the site configuration.xml $cs = \ConfigHandler::LoadConfigFile("configuration"); self::$_Backend = $cs['cache_type']; } if(isset(self::$_KeyCache[$key])){ return self::$_KeyCache[$key]; } switch(self::$_Backend){ case 'apc': if(!class_exists('CacheAPC')){ require_once(__CACHE_PDIR . 'backends/cacheapc.class.php'); ##SKIPCOMPILER } $obj = new CacheAPC($key, null, $expires); break; case 'memcache': case 'memcached': if(!class_exists('Core\Cache\Memcache')){ require_once(__CACHE_PDIR . 'Memcache.php'); ##SKIPCOMPILER } $obj = new Cache\Memcache($key, $expires); break; case 'file': default: if(!class_exists('Core\Cache\File')){ require_once(__CACHE_PDIR . 'File.php'); ##SKIPCOMPILER } if(!is_dir(TMP_DIR . 'cache')){ mkdir(TMP_DIR . 'cache'); } $obj = new Cache\File($key, $expires); break; } self::$_KeyCache[$key] = $obj; return $obj; }