static function factory($driver = null)
    {
        try {
            switch ($driver) {
                case APC:
                    return static::getDriver('APC');
                case MEMCACHED:
                    try {
                        return static::getDriver('Memcached');
                    } catch (Exception $e) {
                        return static::getDriver('Memcache');
                    }
                case MEMCACHE:
                    return static::getDriver('Memcache');
                case MYSQL:
                    return static::getDriver('MySQL');
                default:
                    throw new Exception();
            }
        } catch (Exception $e) {
            $config = Config::getInstance();
            $driver = $config->fallbackDriver ?: 'NoCache';
            return static::getDriver($driver);
        }
    }