MongoPool.php 3.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. <?php
  2. /*
  3. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  4. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  5. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  6. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  7. * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  8. * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  9. * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  10. * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  11. * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  12. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  13. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  14. */
  15. class MongoPool {
  16. /**
  17. * Returns an array of information about all connection pools.
  18. *
  19. * @link http://php.net/manual/en/mongopool.info.php
  20. * @static
  21. * @return array Each connection pool has an identifier, which starts with the host. For
  22. * each pool, this function shows the following fields: $in use The number of
  23. * connections currently being used by Mongo instances. $in pool The number of
  24. * connections currently in the pool (not being used). $remaining The number of
  25. * connections that could be created by this pool. For example, suppose a pool had
  26. * 5 connections remaining and 3 connections in the pool. We could create 8 new
  27. * instances of Mongo before we exhausted this pool (assuming no instances of Mongo
  28. * went out of scope, returning their connections to the pool). A negative number
  29. * means that this pool will spawn unlimited connections. Before a pool is created,
  30. * you can change the max number of connections by calling Mongo::setPoolSize. Once
  31. * a pool is showing up in the output of this function, its size cannot be changed.
  32. * $total The total number of connections allowed for this pool. This should be
  33. * greater than or equal to "in use" + "in pool" (or -1). $timeout The socket
  34. * timeout for connections in this pool. This is how long connections in this pool
  35. * will attempt to connect to a server before giving up. $waiting If you have
  36. * capped the pool size, workers requesting connections from the pool may block
  37. * until other workers return their connections. This field shows how many
  38. * milliseconds workers have blocked for connections to be released. If this number
  39. * keeps increasing, you may want to use MongoPool::setSize to add more connections
  40. * to your pool
  41. */
  42. public static function info() {}
  43. /**
  44. * Sets the max number of connections new pools will be able to create.
  45. *
  46. * @link http://php.net/manual/en/mongopool.setsize.php
  47. * @static
  48. * @param int $size The max number of connections future pools will be able to
  49. * create. Negative numbers mean that the pool will spawn an infinite number of
  50. * connections
  51. * @return boolean Returns the former value of pool size
  52. */
  53. public static function setSize($size) {}
  54. /**
  55. * .
  56. *
  57. * @link http://php.net/manual/en/mongopool.getsize.php
  58. * @static
  59. * @return int Returns the current pool size
  60. */
  61. public static function getSize() {}
  62. }