/** * 单件返回对象 * * @static * @access public * @return void */ public static function getSingle() { if (!is_object(self::$obj)) { self::$obj = new N8_Dblayer_Memcache(); } return self::$obj; }
protected function setUp() { global $_REQUEST; defined('N8_ROOT') ? '' : define('N8_ROOT', '/media/work/code/N8/'); defined('PROJECT_CONFIG') ? '' : define('PROJECT_CONFIG', N8_ROOT . 'unit/'); defined('PROJECT_NAME') ? '' : define('PROJECT_NAME', 'test'); defined('PROJECT_ROOT') ? '' : define('PROJECT_ROOT', dirname(dirname(__FILE__)) . '/'); //项目地址 require_once N8_ROOT . './Config.php'; $this->conf = new N8_Config(PROJECT_CONFIG . '/' . PROJECT_NAME . '.php'); include_once N8_ROOT . './Dblayer/Interface.php'; include_once N8_ROOT . './Dblayer/Keyvalue.php'; include_once N8_ROOT . './Dblayer/Memcache.php'; $this->obj = N8_Dblayer_Memcache::getSingle(); }