public static function instance() { if (null === self::$instance) { $memcacheCfg = TXConfig::getAppConfig('memcache', 'dns'); self::$instance = new self($memcacheCfg); } return self::$instance; }
/** * 获取单例全局量 * @param $name * @return mixed * @throws TXException */ public function __get($name) { switch ($name) { case 'person': return Person::get(); case 'request': return TXRequest::getInstance(); case 'redis': return TXRedis::instance(); case 'memcache': return TXMemcache::instance(); case 'session': return TXSession::instance(); case 'router': case 'cache': $module = 'TX' . ucfirst($name); return TXFactory::create($module); default: throw new TXException(1006, $name); } }