mirror of
https://gitee.com/milvus-io/milvus.git
synced 2025-12-30 15:35:33 +08:00
51 lines
1.1 KiB
C++
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_;
|
|
};
|
|
|
|
|
|
}
|
|
}
|
|
}
|