| 7484 | } |
| 7485 | |
| 7486 | static int getDbSize(void) { |
| 7487 | redisReply *reply; |
| 7488 | int size; |
| 7489 | |
| 7490 | reply = redisCommand(context, "DBSIZE"); |
| 7491 | |
| 7492 | if (reply == NULL) { |
| 7493 | fprintf(stderr, "\nI/O error\n"); |
| 7494 | exit(1); |
| 7495 | } else if (reply->type == REDIS_REPLY_ERROR) { |
| 7496 | fprintf(stderr, "Couldn't determine DBSIZE: %s\n", reply->str); |
| 7497 | exit(1); |
| 7498 | } else if (reply->type != REDIS_REPLY_INTEGER) { |
| 7499 | fprintf(stderr, "Non INTEGER response from DBSIZE!\n"); |
| 7500 | exit(1); |
| 7501 | } |
| 7502 | |
| 7503 | /* Grab the number of keys and free our reply */ |
| 7504 | size = reply->integer; |
| 7505 | freeReplyObject(reply); |
| 7506 | |
| 7507 | return size; |
| 7508 | } |
| 7509 | |
| 7510 | typedef struct { |
| 7511 | char *name; |
no test coverage detected