示例#1
0
 /**
  *
  * @param string $endpoint
  * @throws Exception
  * @return \Memcache\Connection
  */
 public static function instance($endpoint = 'default')
 {
     if (!isset(self::$instances[$endpoint])) {
         if (!self::$configs) {
             self::$configs = (array) new \Config\Memcache();
         }
         $configs = self::$configs;
         if (!isset(self::$configs[$endpoint])) {
             throw new Exception('Config of "' . $endpoint . '" does not exist!', 100);
         }
         self::sanitizeConfig($configs[$endpoint]);
         self::$instances[$endpoint] = self::connect($configs[$endpoint]);
     }
     return self::$instances[$endpoint];
 }