示例#1
0
 /**
  * Connect to the Beanstalk server.
  *
  * @see lithium\data\source\MongoDb::__construct()
  * @link http://php.net/manual/en/mongo.construct.php PHP Manual: Mongo::__construct()
  * @return boolean Returns `true` the connection attempt was successful, otherwise `false`.
  */
 public function connect()
 {
     $config =& $this->_config;
     if (!$this->connection) {
         $this->connection = $this->invokeMethod('_instance', array('service', $this->_config));
         if ($this->connection->connect()) {
             $this->_isConnected = true;
             $this->connection->choose($config['tube']);
             $this->connection->watch($config['tube']);
         }
     }
     return $this->_isConnected;
 }