- PHP 手册
- 函数参考
- 数据库扩展
- 针对各数据库系统对应的扩展
- Mongo
- Miscellaneous
- Mongo
Mongo::getPoolSize
(PECL mongo >=1.2.0)
Mongo::getPoolSize — Get pool size for connection pools
说明
public static Mongo::getPoolSize ( void ) : int WarningThis feature has been DEPRECATED as of version 1.2.3. Relying on this feature is highly discouraged. Please use MongoPool::getSize() instead.
参数
此函数没有参数。
返回值
Returns the current pool size.
更新日志
版本 | 说明 |
---|---|
1.2.11 | Emits E_DEPRECATED when used. |
范例
Example #1 Changing pool size
This returns the default pool size, sets a new pool size, then prints the new pool size and the pool debugging information. Note that changing the pool size only affects new connection pools, it does not change old ones.
<?php
$connection = new Mongo("host1");
// pool size is -1
echo "pool size is: ".Mongo::getPoolSize()."\n";
echo "setting pool size to 200\n";
Mongo::setPoolSize(200);
// pool size is 200
echo "pool size is: ".Mongo::getPoolSize()."\n";
$conn2 = new Mongo("host2");
// remaining for host1 is -2
// remaining for host2 is 199
var_dump(Mongo::poolDebug());
?>
参见
- Mongo::setPoolSize() - Set the size for future connection pools
- Mongo::poolDebug() - Returns information about all connection pools
- The connection documentation.
User Contributed Notes
There are no user contributed notes for this page.官方地址:https://www.php.net/manual/en/mongo.getpoolsize.php