milvus/cpp/src/cache/CacheMgr.h
groot 07b272f058 add cache classes
Former-commit-id: a92eb3ea2a350d6bfd1bf13e2d9c21d29c8205c5
2019-04-14 16:35:46 +08:00

51 lines
1.1 KiB
C++

////////////////////////////////////////////////////////////////////////////////
// Copyright 上海赜睿信息科技有限公司(Zilliz) - All Rights Reserved
// Unauthorized copying of this file, via any medium is strictly prohibited.
// Proprietary and confidential.
////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "Cache.h"
namespace zilliz {
namespace vecwise {
namespace cache {
class CacheMgr {
public:
static CacheMgr& GetInstance() {
static CacheMgr mgr;
return mgr;
}
size_t ItemCount() const;
bool IsExists(const std::string& key);
DataObjPtr GetItem(const std::string& key);
void InsertItem(const std::string& key, const DataObjPtr& data);
void InsertItem(const std::string& key, const std::shared_ptr<char>& data, int64_t size);
void EraseItem(const std::string& key);
void PrintInfo();
void ClearCache();
int64_t CacheUsage() const;
int64_t CacheCapacity() const;
private:
CacheMgr();
private:
CachePtr cache_;
};
}
}
}