mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-16 00:48:54 +00:00
added timeout exception & more timeout doc
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@293290 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
04a0c156ef
commit
0c1849c4b4
3 changed files with 105 additions and 0 deletions
|
@ -13,6 +13,42 @@
|
|||
<modifier>public</modifier> <type>MongoCursor</type><methodname>MongoCursor::timeout</methodname>
|
||||
<methodparam><type>int</type><parameter>ms</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
A timeout can be set at any time and will affect subsequent queries on the
|
||||
cursor, including fetching more results from the database. For example, to
|
||||
wait forever for an initial response but timeout after 100 ms for subsequent
|
||||
results, one could say:
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
|
||||
$cursor = $collection->find();
|
||||
|
||||
// $cursor->hasNext() executes the query. No timeout has been set, so the
|
||||
// program will wait as long as necessary for a response.
|
||||
|
||||
while ($cursor->hasNext()) {
|
||||
$cursor->timeout(100);
|
||||
|
||||
// now the timeout has been set, so if the cursor needs to get more results
|
||||
// from the database, it will only wait 100 ms for the database's reply
|
||||
|
||||
try {
|
||||
print_r($cursor->getNext());
|
||||
}
|
||||
catch(MongoCursorTimeoutException $e) {
|
||||
echo "query took too long!";
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</para>
|
||||
<para>
|
||||
A timeout of 0 (or a negative number) will wait forever so it can be used to
|
||||
reset the cursor if a timeout is no longer needed.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="parameters">
|
||||
|
|
66
reference/mongo/mongocursortimeoutexception.xml
Normal file
66
reference/mongo/mongocursortimeoutexception.xml
Normal file
|
@ -0,0 +1,66 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<!-- $Revision$ -->
|
||||
<phpdoc:classref xml:id="class.mongocursortimeoutexception" xmlns:phpdoc="http://php.net/ns/phpdoc" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude">
|
||||
|
||||
<title>The MongoCursorTimeoutException class</title>
|
||||
<titleabbrev>MongoCursorTimeoutException</titleabbrev>
|
||||
|
||||
<partintro>
|
||||
|
||||
<!-- {{{ MongoCursorTimeoutException intro -->
|
||||
<section xml:id="mongocursortimeoutexception.intro">
|
||||
&reftitle.intro;
|
||||
<para>
|
||||
Caused by a query timing out. At the moment, the only way a query will not
|
||||
wait indefinitely for a database response is if
|
||||
<function>MongoCursor::timeout</function> is called on the cursor.
|
||||
</para>
|
||||
</section>
|
||||
<!-- }}} -->
|
||||
|
||||
<section xml:id="mongocursortimeoutexception.synopsis">
|
||||
&reftitle.classsynopsis;
|
||||
|
||||
<!-- {{{ Synopsis -->
|
||||
<classsynopsis>
|
||||
<ooclass><classname>MongoCursorTimeoutException</classname></ooclass>
|
||||
|
||||
<!-- {{{ Class synopsis -->
|
||||
<classsynopsisinfo>
|
||||
<ooclass>
|
||||
<modifier>extends</modifier>
|
||||
<classname>MongoCursorException</classname>
|
||||
</ooclass>
|
||||
</classsynopsisinfo>
|
||||
<!-- }}} -->
|
||||
|
||||
</classsynopsis>
|
||||
<!-- }}} -->
|
||||
|
||||
</section>
|
||||
|
||||
</partintro>
|
||||
|
||||
</phpdoc:classref>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
mode: sgml
|
||||
sgml-omittag:t
|
||||
sgml-shorttag:t
|
||||
sgml-minimize-attributes:nil
|
||||
sgml-always-quote-attributes:t
|
||||
sgml-indent-step:1
|
||||
sgml-indent-data:t
|
||||
indent-tabs-mode:nil
|
||||
sgml-parent-document:nil
|
||||
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
|
||||
sgml-exposed-tags:nil
|
||||
sgml-local-catalogs:nil
|
||||
sgml-local-ecat-files:nil
|
||||
End:
|
||||
vim600: syn=xml fen fdm=syntax fdl=2 si
|
||||
vim: et tw=78 syn=sgml
|
||||
vi: ts=1 sw=1
|
||||
-->
|
|
@ -10,6 +10,7 @@
|
|||
<!-- Mongo -->
|
||||
<function name='mongo::__construct' from='PECL mongo >=0.9.0'/>
|
||||
<function name='mongo::__tostring' from='PECL mongo >=0.9.0'/>
|
||||
<function name='mongo::__get' from='PECL mongo >=1.0.2'/>
|
||||
<function name='mongo::connect' from='PECL mongo >=0.9.0'/>
|
||||
<function name='mongo::pairConnect' from='PECL mongo >=0.9.0'/>
|
||||
<function name='mongo::persistConnect' from='PECL mongo >=0.9.0'/>
|
||||
|
@ -22,6 +23,7 @@
|
|||
<!-- MongoDB -->
|
||||
<function name='mongodb::__construct' from='PECL mongo >=0.9.0'/>
|
||||
<function name='mongodb::__tostring' from='PECL mongo >=0.9.0'/>
|
||||
<function name='mongodb::__get' from='PECL mongo >=1.0.2'/>
|
||||
<function name='mongodb::createcollection' from='PECL mongo >=0.9.0'/>
|
||||
<function name='mongodb::drop' from='PECL mongo >=0.9.0'/>
|
||||
<function name='mongodb::dropcollection' from='PECL mongo >=0.9.0'/>
|
||||
|
@ -43,6 +45,7 @@
|
|||
<!-- MongoCollection -->
|
||||
<function name='mongocollection::__construct' from='PECL mongo >=0.9.0'/>
|
||||
<function name='mongocollection::__tostring' from='PECL mongo >=0.9.0'/>
|
||||
<function name='mongocollection::__get' from='PECL mongo >=1.0.2'/>
|
||||
<function name='mongocollection::getname' from='PECL mongo >=0.9.0'/>
|
||||
<function name='mongocollection::count' from='PECL mongo >=0.9.0'/>
|
||||
<function name='mongocollection::deleteindex' from='PECL mongo >=0.9.0'/>
|
||||
|
|
Loading…
Reference in a new issue