/** Returns a reference to the current fastDS object, or false * * @return mixed either a fastDS instance or false **/ public static function instance() { if (self::$building) { return false; } if (isset(self::$fastInstance)) { return self::$fastInstance; } //If we already know we aren't set, return false if (isset(self::$enabled) and !self::$enabled) { return false; } $config = vB::getConfig(); if (!isset($config['fastDS']) or !$config['fastDS']) { self::$enabled = false; return false; } if (isset($config['fastDSType'])) { $class = 'vB_FastDS_' . $config['fastDSType']; } else { if (!is_callable('apc_fetch')) { return false; } $class = 'vB_FastDS_APC'; } //Note that if there is a problem with cached data, on instantiotion the cache // object with set enabled to false. self::$enabled = true; self::$fastInstance = new $class($config); return self::$fastInstance; }