提交 18b59c13 编写于 作者: G groot

refine cache code


Former-commit-id: 897cfc2ee63bc4a941fe122ef98ae7dd853a9e4e
上级 4ec11416
......@@ -56,11 +56,11 @@ void Cache<ItemObj>::insert(const std::string& key, const ItemObj& item) {
return;
}
if(item->size() > capacity_) {
SERVER_LOG_ERROR << "Item size " << item->size()
<< " is too large to insert into cache, capacity " << capacity_;
return;
}
// if(item->size() > capacity_) {
// SERVER_LOG_ERROR << "Item size " << item->size()
// << " is too large to insert into cache, capacity " << capacity_;
// return;
// }
//calculate usage
{
......
......@@ -162,7 +162,7 @@ TEST(CacheTest, CPU_CACHE_TEST) {
engine::VecIndexPtr mock_index = std::make_shared<MockVecIndex>(256, 6000000);
cache::DataObjPtr data_obj = std::make_shared<cache::DataObj>(mock_index);
cpu_mgr->InsertItem("index_6g", data_obj);
ASSERT_FALSE(cpu_mgr->ItemExists("index_6g"));//data greater than capacity can not be inserted sucessfully
ASSERT_TRUE(cpu_mgr->ItemExists("index_6g"));
}
cpu_mgr->PrintInfo();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册