Skip to content

Commit

Permalink
Fix Benchmark
Browse files Browse the repository at this point in the history
  • Loading branch information
hggq committed Jun 23, 2024
1 parent 67e515b commit bb6867f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
9 changes: 4 additions & 5 deletions controller/src/techempower.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,7 @@ std::string techempowerdb(std::shared_ptr<httppeer> peer)
peer->set_header("Date", get_gmttime());
auto myworld = orm::World();
unsigned int rd_num = rand_range(1, 10000);
myworld.get_one(rd_num);

myworld.where("id",rd_num).limit(1).fetch_one();
peer->output = myworld.data_tojson();
return "";
}
Expand Down Expand Up @@ -170,7 +169,7 @@ std::string techempowercached_queries(std::shared_ptr<httppeer> peer)
allcachedata_array[i].id = i + 1;
allcachedata_array[i].randomnumber = rand_range(1, 10000);
}
temp_cache.save(mycacheid, allcachedata_array, 120);
temp_cache.save(mycacheid, allcachedata_array, 360);
}
//get rand data from cache
mycacheid = "my" + std::to_string(get_num);
Expand All @@ -189,7 +188,7 @@ std::string techempowercached_queries(std::shared_ptr<httppeer> peer)
myworld.record.push_back(allcachedata_array[temp_rid]);
}
}
temp_cache.save(mycacheid, myworld.record, 120);
temp_cache.save(mycacheid, myworld.record, 360);
}

peer->output = myworld.to_json();
Expand Down Expand Up @@ -231,7 +230,7 @@ std::string techempowercached_db(std::shared_ptr<httppeer> peer)

std::string sqlstr = array_to_sql(cacheid);
myworld.whereIn("id", sqlstr).fetch();
temp_cache.save(mycacheid, myworld.record, 120);
temp_cache.save(mycacheid, myworld.record, 360);
}

peer->output = myworld.to_json();
Expand Down
1 change: 1 addition & 0 deletions vendor/httpserver/include/pzcache.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#endif// defined(_MSC_VER) && (_MSC_VER >= 1200)
#include <string>
#include <map>
#include <mutex>

namespace http
{
Expand Down

0 comments on commit bb6867f

Please sign in to comment.