<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title>Sets whether this cursor will timeout</title> </head> <body><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="mongocursor.hint.html">MongoCursor::hint</a></div> <div class="next" style="text-align: right; float: right;"><a href="mongocursor.info.html">MongoCursor::info</a></div> <div class="up"><a href="class.mongocursor.html">MongoCursor</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div><hr /><div id="mongocursor.immortal" class="refentry"> <div class="refnamediv"> <h1 class="refname">MongoCursor::immortal</h1> <p class="verinfo">(PECL mongo >=1.0.1)</p><p class="refpurpose"><span class="refname">MongoCursor::immortal</span> — <span class="dc-title">Sets whether this cursor will timeout</span></p> </div> <div class="refsect1 description" id="refsect1-mongocursor.immortal-description"> <h3 class="title">Description</h3> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type"><a href="class.mongocursor.html" class="type MongoCursor">MongoCursor</a></span> <span class="methodname"><strong>MongoCursor::immortal</strong></span> ([ <span class="methodparam"><span class="type">bool</span> <code class="parameter">$liveForever</code><span class="initializer"> = true</span></span> ] )</div> <p class="para rdfs-comment"> After remaining idle on the server for some amount of time, cursors, by default, "die." This is generally the behavior one wants. The database cleans up a cursor once all of its results have been sent to the client, but if the client doesn't request all of the results, the cursor will languish there, taking up resources. Thus, after a few minutes, the cursor "times out" and the database assumes the client has gotten everything it needs and cleans up its the cursor's resources. </p> <p class="para"> If, for some reason, you need a cursor to hang around for a long time, you can prevent the database from cleaning it up by using this method. However, if you make a cursor immortal, you need to iterate through all of its results (or at least until <span class="methodname"><a href="mongocursor.dead.html" class="methodname">MongoCursor::dead()</a></span> returns <strong><code>TRUE</code></strong>) or the cursor will hang around the database <em class="emphasis">forever</em>, taking up resources. </p> </div> <div class="refsect1 parameters" id="refsect1-mongocursor.immortal-parameters"> <h3 class="title">Parameters</h3> <p class="para"> <dl> <dt> <span class="term"> <em><code class="parameter">liveForever</code></em> </span> <dd> <p class="para"> If the cursor should be immortal. </p> </dd> </dt> </dl> </p> </div> <div class="refsect1 returnvalues" id="refsect1-mongocursor.immortal-returnvalues"> <h3 class="title">Return Values</h3> <p class="para"> Returns this cursor. </p> </div> <div class="refsect1 errors" id="refsect1-mongocursor.immortal-errors"> <h3 class="title">Errors/Exceptions</h3> <p class="para"> Throws <a href="class.mongocursorexception.html" class="classname">MongoCursorException</a> if this cursor has started iterating. </p> </div> </div><hr /><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="mongocursor.hint.html">MongoCursor::hint</a></div> <div class="next" style="text-align: right; float: right;"><a href="mongocursor.info.html">MongoCursor::info</a></div> <div class="up"><a href="class.mongocursor.html">MongoCursor</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div></body></html>