1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125
|
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision: 330987 $ -->
<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>
<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
-->
|