/** * Returns singleton instance of self. * @todo This can be inherited once late static binding is available. For now * it has to be redefined in the child classes * * @return vB_Cache_Db - Reference to singleton instance of cache handler */ public static function instance() { if (!isset(self::$instance)) { $class = __CLASS__; self::$instance = new $class(); } return self::$instance; }
/** * Returns an instance of the global cache. * The cache type used is defined in options. * * @return vB_Cache - Reference to instance of the cache handler */ public static function instance() { if (!isset(self::$instance)) { // TODO: Use config to determine the cache types to use self::$instance = vB_Cache_Db::instance(); // TODO: Get appropriate class from options self::$instance->attachObserver(vB_Cache_Observer_Db::instance(self::$instance)); vB::$vbulletin->shutdown->add(array(self::$instance, 'shutdown')); } if (vB::$vbulletin->debug and $_REQUEST['nocache']) { vB::$vbulletin->options['nocache'] = 1; } return self::$instance; }