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

Function getDbSize

src/redis-cli.c:6576–6598  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6574}
6575
6576int getDbSize(void) {
6577 redisReply *reply;
6578 int size;
6579
6580 reply = redisCommand(context, "DBSIZE");
6581
6582 if (reply == NULL) {
6583 fprintf(stderr, "\nI/O error\n");
6584 exit(1);
6585 } else if (reply->type == REDIS_REPLY_ERROR) {
6586 fprintf(stderr, "Couldn't determine DBSIZE: %s\n", reply->str);
6587 exit(1);
6588 } else if (reply->type != REDIS_REPLY_INTEGER) {
6589 fprintf(stderr, "Non INTEGER response from DBSIZE!\n");
6590 exit(1);
6591 }
6592
6593 /* Grab the number of keys and free our reply */
6594 size = reply->integer;
6595 freeReplyObject(reply);
6596
6597 return size;
6598}
6599
6600typeinfo type_string = { "string", "STRLEN", "bytes" };
6601typeinfo type_list = { "list", "LLEN", "items" };

Callers 2

findHotKeysFunction · 0.85
findBigKeysFunction · 0.85

Calls 2

freeReplyObjectFunction · 0.85
redisCommandClass · 0.70

Tested by

no test coverage detected