downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

MongoCursor::info> <MongoCursor::hint
Last updated: Fri, 20 May 2011

view this page in

MongoCursor::immortal

(PECL mongo >=1.0.1)

MongoCursor::immortalSets whether this cursor will timeout

Descripción

public MongoCursor MongoCursor::immortal ([ bool $liveForever = true ] )

After remaining idle for some amount of time, cursor, 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.

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 Cursor::dead() returns TRUE) or the cursor will hang around the database forever, taking up resources.

Parámetros

liveForever

If the cursor should be immortal.

Valores devueltos

Returns this cursor.

Errores/Excepciones

Throws MongoCursorException if this cursor has started iterating.



add a note add a note User Contributed Notes MongoCursor::immortal
blabla at gmail dot com 27-Jan-2011 10:08
driver version 1.0.11
method immortal() seems just do not functioning
use timeout(-1) instead

 
show source | credits | stats | sitemap | contact | advertising | mirror sites