feat(db): add cache

Former-commit-id: 2dd8078d8df484ddac54379bc6c84c015c1fc530
This commit is contained in:
Xu Peng 2019-04-30 15:50:24 +08:00
parent 052f7e2f11
commit 713d1ec6b7
3 changed files with 11 additions and 0 deletions

View File

@ -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

View File

@ -24,6 +24,8 @@ public:
virtual Status Serialize() override;
virtual Status Cache() override;
protected:
std::shared_ptr<faiss::Index> pIndex_;
std::string location_;

View File

@ -22,6 +22,8 @@ public:
virtual Status Serialize() = 0;
virtual Status Cache() = 0;
virtual ~Serializer() {}
};