Пример #1
0
 public function get_backend($write = False)
 {
     if (!class_exists('\\HandlerSocket')) {
         throw new HSNotLoadedError();
     }
     $this->_load_config();
     $this->_check_config();
     if (static::$_default_connection) {
         return static::$_default_connection;
     }
     $conf = $this->_config['handlersocket'];
     $handlersocket = new \HandlerSocket($conf['host'], $conf['port']);
     $handlersocket_wr = new \HandlerSocket($conf['host'], $conf['port_wr']);
     $hs = HS::create()->set_handlersocket($handlersocket, $handlersocket_wr)->set_db($this->get_db_name());
     static::$_default_connection = $hs;
     return $hs;
 }