| 6574 | } |
| 6575 | |
| 6576 | int 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 | |
| 6600 | typeinfo type_string = { "string", "STRLEN", "bytes" }; |
| 6601 | typeinfo type_list = { "list", "LLEN", "items" }; |
no test coverage detected