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
| 785 | * On success C_OK is returned and the flags are stored in *flags, otherwise |
| 786 | * C_ERR is returned and the function sends an error to the client. */ |
| 787 | int getFlushCommandFlags(client *c, int *flags) { |
| 788 | /* Parse the optional ASYNC option. */ |
| 789 | if (c->argc == 2 && !strcasecmp(szFromObj(c->argv[1]),"sync")) { |
| 790 | *flags = EMPTYDB_NO_FLAGS; |
| 791 | } else if (c->argc == 2 && !strcasecmp(szFromObj(c->argv[1]),"async")) { |
| 792 | *flags = EMPTYDB_ASYNC; |
| 793 | } else if (c->argc == 1) { |
| 794 | *flags = g_pserver->lazyfree_lazy_user_flush ? EMPTYDB_ASYNC : EMPTYDB_NO_FLAGS; |
| 795 | } else { |
| 796 | addReplyErrorObject(c,shared.syntaxerr); |
| 797 | return C_ERR; |
| 798 | } |
| 799 | return C_OK; |
| 800 | } |
| 801 | |
| 802 | /* Flushes the whole server data set. */ |
| 803 | void flushAllDataAndResetRDB(int flags) { |
no test coverage detected