Skip to content

Commit

Permalink
add flushall cache clear
Browse files Browse the repository at this point in the history
  • Loading branch information
Mixficsol committed Mar 29, 2024
1 parent ac8e1dc commit be9da25
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion include/pika_admin.h
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ class FlushallCmd : public Cmd {
: Cmd(name, arity, flag, static_cast<uint32_t>(AclCategory::KEYSPACE)) {}
void Do() override;
void DoThroughDB() override;
void DoUpdateCache() override;
void DoUpdateCache(std::shared_ptr<DB> db);
void Split(const HintKeys& hint_keys) override{};
void Merge() override{};
Cmd* Clone() override { return new FlushallCmd(*this); }
Expand Down
5 changes: 3 additions & 2 deletions src/pika_admin.cc
Original file line number Diff line number Diff line change
Expand Up @@ -553,10 +553,10 @@ void FlushallCmd::DoThroughDB() {
Do();
}

void FlushallCmd::DoUpdateCache() {
void FlushallCmd::DoUpdateCache(std::shared_ptr<DB> db) {
// clear cache
if (PIKA_CACHE_NONE != g_pika_conf->cache_model()) {
g_pika_server->ClearCacheDbAsync(db_);
g_pika_server->ClearCacheDbAsync(db);
}
}

Expand All @@ -580,6 +580,7 @@ void FlushallCmd::DoWithoutLock(std::shared_ptr<DB> db) {
LOG(INFO) << "Flushall, but DB not found";
} else {
db->FlushDBWithoutLock();
DoUpdateCache(db);
}
}

Expand Down

0 comments on commit be9da25

Please sign in to comment.