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);
        }
    }
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);
        }
    }
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 ) ; } }
Factory for getting instances on cache objects.
You specify the driver to use as a parameter, and
it automatically falls back to the "NoCache" driver
if not found
@return \ManiaLib\Cache\CacheInterface
Factory for getting instances on cache objects . You specify the driver to use as a parameter and it automatically falls back to the NoCache driver if not found