提交 86de13c8 编写于 作者: G groot

add cache classes


Former-commit-id: 3f1545335159443d0b86bacbd6fdecd040f40820
上级 53617bd8
......@@ -4,7 +4,7 @@
# Proprietary and confidential.
#-------------------------------------------------------------------------------
AUX_SOURCE_DIRECTORY(./cache cache_files)
aux_source_directory(./cache cache_files)
set(vecwise_engine_src
${CMAKE_CURRENT_SOURCE_DIR}/main.cpp
......
......@@ -15,15 +15,15 @@ CacheMgr::CacheMgr() {
cache_ = std::make_shared<Cache>(16, 1UL<<32);
}
size_t CacheMgr::ItemCount() const {
uint64_t CacheMgr::ItemCount() const {
if(cache_ == nullptr) {
return 0;
}
return cache_->size();
return (uint64_t)(cache_->size());
}
bool CacheMgr::IsExists(const std::string& key) {
bool CacheMgr::ItemExists(const std::string& key) {
if(cache_ == nullptr) {
return false;
}
......
......@@ -19,9 +19,9 @@ public:
return mgr;
}
size_t ItemCount() const;
uint64_t ItemCount() const;
bool IsExists(const std::string& key);
bool ItemExists(const std::string& key);
DataObjPtr GetItem(const std::string& key);
......
......@@ -5,9 +5,7 @@
#-------------------------------------------------------------------------------
include_directories(../../src)
set(cache_srcs
../../src/cache/Cache.cpp
../../src/cache/CacheMgr.cpp)
aux_source_directory(../../src/cache cache_srcs)
set(cache_test_src
${unittest_srcs}
......
......@@ -32,7 +32,7 @@ TEST(CacheTest, CACHE_TEST) {
cache_mgr.InsertItem(key, MAKE_100MB_DATA);
cache::DataObjPtr data = cache_mgr.GetItem(key);
ASSERT_TRUE(data != nullptr);
ASSERT_TRUE(cache_mgr.IsExists(key));
ASSERT_TRUE(cache_mgr.ItemExists(key));
ASSERT_EQ(data->size(), 100*1024*1024);
cache_mgr.EraseItem(key);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册