php-doc-en/reference/mongo/mongoclient/killcursor.xml
2015-11-19 13:46:44 +00:00

129 lines
3.8 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="mongoclient.killcursor" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>MongoClient::killCursor</refname>
<refpurpose>Kills a specific cursor on the server</refpurpose>
</refnamediv>
<refsynopsisdiv role="soft-deprecation-notice">
&mongo.noalternative.method.note;
</refsynopsisdiv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>bool</type><methodname>MongoClient::killCursor</methodname>
<methodparam><type>string</type><parameter>server_hash</parameter></methodparam>
<methodparam><type>int|MongoInt64</type><parameter>id</parameter></methodparam>
</methodsynopsis>
<para>
In certain situations it might be needed to kill a cursor on the server.
Usually cursors time out after 10 minutes of inactivity, but it is possible
to create an immortal cursor with
<methodname>MongoCursor::immortal</methodname> that never times out. In
order to be able to kill such an immortal cursor, you can call this
method with the information supplied by
<methodname>MongoCursor::info</methodname>.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term>
<parameter>server_hash</parameter>
</term>
<listitem>
<para>
The server hash that has the cursor. This can be obtained through
<methodname>MongoCursor::info</methodname>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<parameter>id</parameter>
</term>
<listitem>
<para>
The ID of the cursor to kill. You can either supply an <type>int</type>
containing the 64 bit cursor ID, or an object of the
<classname>MongoInt64</classname> class. The latter is necessary on 32
bit platforms (and Windows).
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns &true; if the method attempted to kill a cursor, and &false; if
there was something wrong with the arguments (such as a wrong
<parameter>server_hash</parameter>). The return status does <emphasis>not
reflect</emphasis> where the cursor was actually killed as the server does
not provide that information.
</para>
</refsect1>
<refsect1 role="errors">
&reftitle.errors;
<para>
This method displays a warning if the supplied
<parameter>server_hash</parameter> does not match up with an existing
connection. No attempt to kill a cursor is attempted in that case either.
</para>
</refsect1>
<refsect1 role="examples" xml:id="mongo.mongoclient.killcursor.examples">
&reftitle.examples;
<example>
<title><function>MongoClient::killCursor</function> example</title>
<para>
This example shows how to connect, do a query, obtain the cursor
information and then kill the cursor.
</para>
<programlisting role="php">
<![CDATA[
<?php
$m = new MongoClient();
$c = $m->testdb->collection;
$cursor = $c->find();
$result = $cursor->next();
// Now the cursor is valid, so we can get the hash and ID out:
$info = $cursor->info();
// Kill the cursor
MongoClient::killCursor( $info['server'], $info['id'] );
?>
]]>
</programlisting>
</example>
</refsect1>
</refentry>
<!-- 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
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
-->