转:Mongodb源码分析--游标Cursor

[复制链接]
查看11 | 回复1 | 2011-11-1 16:25:51 | 显示全部楼层 |阅读模式
原文. http://www.cnblogs.com/daizhj/ar ... or_source_code.html

我补充一些官方内容,不管是开发或者管理,都需要了解的.
Cursor Internals
There are two sides to a cursor: the client-facing cursor and the database cursor that
the client-side one represents.
On the server side, a cursor takes up memory and resources. Once a cursor runs out of
results or the client sends a message telling it to die, the database can free the resources
it was using. Freeing these resources lets the database use them for other things, which
is good, so we want to make sure that cursors can be freed quickly (within reason).
3种情况下,销毁database cursor
There are a couple of conditions that can cause the death (and subsequent cleanup) of
a cursor.
First, when a cursor finishes iterating through the matching results, it will
clean itself up.
Another way is that, when a cursor goes out of scope on the client side,
the drivers send the database a special message to let it know that it can kill that cursor.
Finally, even if the user hasn’t iterated through all the results and the cursor is still in
scope, after 10 minutes of inactivity, a database cursor will automatically “die.” #这个可以设置不超时.
回复

使用道具 举报

千问 | 2011-11-1 16:25:51 | 显示全部楼层
good
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行