我在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并添加一些参数以刷新页面。。。
谢谢你的帮助。

最佳答案

在这个版本中,微缓存的使用寿命显然太长,但是如何绕过它是well-documented

关于c - 使用mongoDB时,G-WAN行为异常,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/16230262/

10-09 17:19