MCPcopy Create free account
hub / github.com/Snapchat/KeyDB / flushallCommand

Function flushallCommand

src/db.cpp:864–886  ·  view source on GitHub ↗

FLUSHALL [ASYNC] * * Flushes the whole server data set. */

Source from the content-addressed store, hash-verified

862 *
863 * Flushes the whole server data set. */
864void flushallCommand(client *c) {
865 int flags;
866
867 if (c->argc == 2)
868 {
869 if (!strcasecmp(szFromObj(c->argv[1]), "cache"))
870 {
871 if (g_pserver->m_pstorageFactory == nullptr)
872 {
873 addReplyError(c, "Cannot flush cache without a storage provider set");
874 return;
875 }
876 for (int idb = 0; idb < cserver.dbnum; ++idb)
877 g_pserver->db[idb]->removeAllCachedValues();
878 addReply(c,shared.ok);
879 return;
880 }
881 }
882
883 if (getFlushCommandFlags(c,&flags) == C_ERR) return;
884 flushAllDataAndResetRDB(flags);
885 addReply(c,shared.ok);
886}
887
888/* This command implements DEL and LAZYDEL. */
889void delGenericCommand(client *c, int lazy) {

Callers

nothing calls this directly

Calls 6

szFromObjFunction · 0.85
addReplyErrorFunction · 0.85
addReplyFunction · 0.85
getFlushCommandFlagsFunction · 0.85
flushAllDataAndResetRDBFunction · 0.85
removeAllCachedValuesMethod · 0.80

Tested by

no test coverage detected