示例#1
0
 public static function instance()
 {
     if (null === self::$instance) {
         $memcacheCfg = TXConfig::getAppConfig('memcache', 'dns');
         self::$instance = new self($memcacheCfg);
     }
     return self::$instance;
 }
示例#2
0
文件: TXApp.php 项目: billge1205/biny
 /**
  * 获取单例全局量
  * @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);
     }
 }