我正在与G-WAN和mongoDB合作,我有一个奇怪的行为。当我显示我的页面时,它看起来没问题。如果我刷新它,它将在刷新5或6次后停止工作。
下面是代码
// ============================================================================
// C servlet sample for the G-WAN Web Application Server (http://trustleap.ch/)
// ----------------------------------------------------------------------------
// mongodb.c: querying mongoDB from G-WAM
// ============================================================================
#pragma link "mongoc"
#pragma link "bson"
#include <mongo.h>
#include <bson.h>
#include "gwan.h" // G-WAN exported functions
int main(int argc, char *argv[])
{
u64 start = getus();
xbuf_t *reply = get_reply(argv);
mongo conn[1];
int status = mongo_client( conn, "localhost", 27017 );
if( status != MONGO_OK ) {
xbuf_xcat(reply, "ERROR MONGO %d", status);
}
int i = 0;
for(i=0; i<2;i++) {
bson b[1];
bson_init( b );
bson_append_new_oid( b, "_id" );
bson_append_string( b, "name", "Joe" );
bson_append_int( b, "age", 33 );
bson_finish( b );
mongo_insert( conn, "tutorial.people", b, NULL );
bson_destroy( b );
}
xbuf_xcat(reply, "Hello Mongo !! %llU %d %d %llU micro seconds", getus(), status, i, (getus() - start));
mongo_destroy(conn);
return 200;
}
// ============================================================================
// End of Source Code
// ============================================================================日志里没什么特别的.
[Fri Apr 26 06:36:57 2013 GMT] 127.0.0.1 "GET /?forum.c" 200 60 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:20.0) Gecko/20100101 Firefox/20.0"浏览器似乎已冻结,getus()值未刷新...就像显示一个g-wan缓存版本一样...
更新我认为这是G-WAN内部缓存问题...更改我的url并添加一些参数将刷新页面...
谢谢你的帮助。
发布于 2013-04-29 14:43:47
在这个版本中,微缓存的寿命显然太长了,但如何绕过它是well-documented。
https://stackoverflow.com/questions/16230262
复制相似问题