Set the size for future connection pools.
public setPoolSize ( $size ) : boolean | ||
$size | The max number of connections future pools will be able to create. Negative numbers mean that the pool will spawn an infinite number of connections. |
|
return | boolean | Returns the former value of pool size. |
public function testPoolSize() { $this->assertEquals(Mongo::getPoolSize(), -1); Mongo::setPoolSize(4.1); $this->assertEquals(Mongo::getPoolSize(), 4); Mongo::setPoolSize(0); $thrown = false; try { $m = new Mongo("mongodb://localhost:20000"); } catch (MongoException $e) { $this->assertStringEndsWith("pool", $e->getMessage()); $thrown = true; } $this->assertTrue($thrown); Mongo::setPoolSize(-1); }