MCPcopy Create free account
hub / github.com/F-Stack/f-stack / flushdbCommand

Function flushdbCommand

app/redis-6.2.6/src/db.c:656–669  ·  view source on GitHub ↗

FLUSHDB [ASYNC] * * Flushes the currently SELECTed Redis DB. */

Source from the content-addressed store, hash-verified

654 *
655 * Flushes the currently SELECTed Redis DB. */
656void flushdbCommand(client *c) {
657 int flags;
658
659 if (getFlushCommandFlags(c,&flags) == C_ERR) return;
660 server.dirty += emptyDb(c->db->id,flags,NULL);
661 addReply(c,shared.ok);
662#if defined(USE_JEMALLOC)
663 /* jemalloc 5 doesn't release pages back to the OS when there's no traffic.
664 * for large databases, flushdb blocks for long anyway, so a bit more won't
665 * harm and this way the flush and purge will be synchroneus. */
666 if (!(flags & EMPTYDB_ASYNC))
667 jemalloc_purge();
668#endif
669}
670
671/* FLUSHALL [ASYNC]
672 *

Callers

nothing calls this directly

Calls 4

getFlushCommandFlagsFunction · 0.85
emptyDbFunction · 0.85
addReplyFunction · 0.85
jemalloc_purgeFunction · 0.85

Tested by

no test coverage detected