mirror of
https://gitee.com/milvus-io/milvus.git
synced 2026-01-07 19:31:51 +08:00
feat(db): add cache
Former-commit-id: 2dd8078d8df484ddac54379bc6c84c015c1fc530
This commit is contained in:
parent
052f7e2f11
commit
713d1ec6b7
@ -1,6 +1,7 @@
|
||||
#include <easylogging++.h>
|
||||
#include <faiss/AutoTune.h>
|
||||
#include <wrapper/Index.h>
|
||||
#include <cache/CpuCacheMgr.h>
|
||||
|
||||
#include "FaissSerializer.h"
|
||||
|
||||
@ -33,6 +34,12 @@ Status FaissSerializer::Serialize() {
|
||||
return Status::OK();
|
||||
}
|
||||
|
||||
Status FaissSerializer::Cache() {
|
||||
zilliz::vecwise::cache::CpuCacheMgr::GetInstance(
|
||||
)->InsertItem(location_, std::make_shared<Index>(pIndex_));
|
||||
|
||||
return Status::OK();
|
||||
}
|
||||
|
||||
} // namespace engine
|
||||
} // namespace vecwise
|
||||
|
||||
@ -24,6 +24,8 @@ public:
|
||||
|
||||
virtual Status Serialize() override;
|
||||
|
||||
virtual Status Cache() override;
|
||||
|
||||
protected:
|
||||
std::shared_ptr<faiss::Index> pIndex_;
|
||||
std::string location_;
|
||||
|
||||
@ -22,6 +22,8 @@ public:
|
||||
|
||||
virtual Status Serialize() = 0;
|
||||
|
||||
virtual Status Cache() = 0;
|
||||
|
||||
virtual ~Serializer() {}
|
||||
};
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user