提交 485f0a1f 编写于 作者: M Megvii Engine Team

fix(imperative): fix redis fastrun cache server

GitOrigin-RevId: 252a0afdc39db4c9d4bede26b9956fcac83cb59a
上级 551cad49
......@@ -93,19 +93,20 @@ public:
}
std::optional<size_t> clear() override {
size_t cursor = 0, nr_deleted = 0;
std::string pattern = m_prefix + "@*";
long long cursor = 0;
size_t nr_deleted = 0;
std::string pattern = m_prefix + "*";
do {
auto reply = m_client.scan(cursor, pattern).share();
sync();
auto keys = reply.get().as_array();
std::vector<std::string> string_keys;
for (auto&& key : keys) {
for (auto&& key : keys[1].as_array()) {
string_keys.push_back(key.as_string());
}
m_client.del(string_keys);
nr_deleted += string_keys.size();
cursor = reply.get().as_array()[0].as_integer();
cursor = std::stoll(keys[0].as_string());
} while (cursor != 0);
return nr_deleted;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册