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

Function getFlushCommandFlags

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

Return the set of flags to use for the emptyDb() call for FLUSHALL * and FLUSHDB commands. * * sync: flushes the database in an sync manner. * async: flushes the database in an async manner. * no option: determine sync or async according to the value of lazyfree-lazy-user-flush. * * On success C_OK is returned and the flags are stored in *flags, otherwise * C_ERR is returned and the functi

Source from the content-addressed store, hash-verified

610 * On success C_OK is returned and the flags are stored in *flags, otherwise
611 * C_ERR is returned and the function sends an error to the client. */
612int getFlushCommandFlags(client *c, int *flags) {
613 /* Parse the optional ASYNC option. */
614 if (c->argc == 2 && !strcasecmp(c->argv[1]->ptr,"sync")) {
615 *flags = EMPTYDB_NO_FLAGS;
616 } else if (c->argc == 2 && !strcasecmp(c->argv[1]->ptr,"async")) {
617 *flags = EMPTYDB_ASYNC;
618 } else if (c->argc == 1) {
619 *flags = server.lazyfree_lazy_user_flush ? EMPTYDB_ASYNC : EMPTYDB_NO_FLAGS;
620 } else {
621 addReplyErrorObject(c,shared.syntaxerr);
622 return C_ERR;
623 }
624 return C_OK;
625}
626
627/* Flushes the whole server data set. */
628void flushAllDataAndResetRDB(int flags) {

Callers 2

flushdbCommandFunction · 0.85
flushallCommandFunction · 0.85

Calls 2

strcasecmpFunction · 0.85
addReplyErrorObjectFunction · 0.85

Tested by

no test coverage detected