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

Function lcsGetKeys

src/db.cpp:2378–2400  ·  view source on GitHub ↗

LCS ... [KEYS ] ... */

Source from the content-addressed store, hash-verified

2376
2377/* LCS ... [KEYS <key1> <key2>] ... */
2378int lcsGetKeys(struct redisCommand *cmd, robj **argv, int argc, getKeysResult *result) {
2379 int i;
2380 int *keys = getKeysPrepareResult(result, 2);
2381 UNUSED(cmd);
2382
2383 /* We need to parse the options of the command in order to check for the
2384 * "KEYS" argument before the "STRINGS" argument. */
2385 for (i = 1; i < argc; i++) {
2386 char *arg = szFromObj(argv[i]);
2387 int moreargs = (argc-1) - i;
2388
2389 if (!strcasecmp(arg, "strings")) {
2390 break;
2391 } else if (!strcasecmp(arg, "keys") && moreargs >= 2) {
2392 keys[0] = i+1;
2393 keys[1] = i+2;
2394 result->numkeys = 2;
2395 return result->numkeys;
2396 }
2397 }
2398 result->numkeys = 0;
2399 return result->numkeys;
2400}
2401
2402/* Helper function to extract keys from memory command.
2403 * MEMORY USAGE <key> */

Callers

nothing calls this directly

Calls 2

getKeysPrepareResultFunction · 0.85
szFromObjFunction · 0.85

Tested by

no test coverage detected