downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

Mongo::setSlaveOkay> <Mongo::selectDB
[edit] Last updated: Sat, 07 Jan 2012

view this page in

Mongo::setPoolSize

(No version information available, might only be in SVN)

Mongo::setPoolSizeSet the size for future connection pools.

설명

public static bool Mongo::setPoolSize ( int $size )
Warning

This feature has been DEPRECATED as of version 1.2.3. Relying on this feature is highly discouraged. Please use MongoPool::setSize() instead.

Sets the max number of connections new pools will be able to create.

인수

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.

반환값

Returns the former value of pool size.

예제

Example #1 Mongo::setPoolSize() example

If you set the pool size to n and then create n connections, attempting to create an n+1st connection will throw a MongoConnectionException.

<?php

// only allow one connection to a server
Mongo::setPoolSize(1);

// creates one connection to localhost:27017
$m1 = new Mongo();

// attempt to create a second connection to localhost:27017
// only one connection is allowed, so this will throw an exception
$m2 = new Mongo();

?>

위 예제의 출력 예시:

Fatal error: Uncaught exception 'MongoConnectionException' with message 'no more connections in pool' in /path/to/php/script.php:10
Stack trace:
#0 /path/to/php/script.php(10): Mongo->__construct()
#1 {main}
  thrown in /path/to/php/script.php on line 10

참고



add a note add a note User Contributed Notes Mongo::setPoolSize
There are no user contributed notes for this page.

 
show source | credits | stats | sitemap | contact | advertising | mirror sites