svn: /phpdoc/en/trunk/reference/mongo/mongo/ setpoolsize.xml

From: Date: Wed, 20 Jul 2011 19:39:22 +0000
Subject: svn: /phpdoc/en/trunk/reference/mongo/mongo/ setpoolsize.xml
Groups: php.doc.cvs 
Request: Send a blank email to doc-cvs+get-8518@lists.php.net to get a copy of this message
kristina Wed, 20 Jul 2011 19:39:22 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=313486 Log: Added example and "see also" section Changed paths: UU phpdoc/en/trunk/reference/mongo/mongo/setpoolsize.xml Modified: phpdoc/en/trunk/reference/mongo/mongo/setpoolsize.xml =================================================================== --- phpdoc/en/trunk/reference/mongo/mongo/setpoolsize.xml 2011-07-20 18:59:05 UTC (rev 313485) +++ phpdoc/en/trunk/reference/mongo/mongo/setpoolsize.xml 2011-07-20 19:39:22 UTC (rev 313486) @@ -6,19 +6,19 @@ <refname>Mongo::setPoolSize</refname> <refpurpose>Set the size for future connection pools.</refpurpose> </refnamediv> - + <refsect1 role="description"> &reftitle.description; <methodsynopsis> - <modifier>public</modifier> <type>bool</type><methodname>Mongo::setPoolSize</methodname> + <modifier>public</modifier> <modifier>static</modifier> <type>bool</type><methodname>Mongo::setPoolSize</methodname> <methodparam><type>int</type><parameter>size</parameter></methodparam> </methodsynopsis> - + <para> Sets the max number of connections new pools will be able to create. </para> </refsect1> - + <refsect1 role="parameters"> &reftitle.parameters; <para> @@ -38,13 +38,68 @@ </variablelist> </para> </refsect1> - + <refsect1 role="returnvalues"> &reftitle.returnvalues; <para> Returns the former value of pool size. </para> </refsect1> + + + <refsect1 role="examples"><!-- {{{ --> + &reftitle.examples; + <para> + <example xml:id="mongo.setpoolsize.example.basic"><!-- {{{ --> + <title><function>Mongo::setPoolSize</function> example</title> + <para> + If you set the pool size to <literal>n</literal> and then create + <literal>n</literal> connections, attempting to create an + <literal>n+1</literal>st connection will throw a + <classname>MongoConnectionException</classname>. + </para> + <programlisting role="php"> +<![CDATA[ +<?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(); + +?> +]]> + </programlisting> + &example.outputs.similar; + <screen> +<![CDATA[ +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 +]]> + </screen> + </example><!-- }}} --> + </para> + </refsect1><!-- }}} --> + + + <refsect1 role="seealso"><!-- {{{ --> + &reftitle.seealso; + <para> + <simplelist> + <member><function>Mongo::getPoolSize</function></member> + <member><function>Mongo::poolDebug</function></member> + <member>The <link linkend="mongo.connecting">connection</link> documentation.</member> + </simplelist> + </para> + </refsect1><!-- }}} --> </refentry> <!-- Keep this comment at the end of the file Local variables: Property changes on: phpdoc/en/trunk/reference/mongo/mongo/setpoolsize.xml ___________________________________________________________________ Added: svn:eol-style + native

« previous php.doc.cvs (#8518) next »