Skip to content

Commit

Permalink
Merge pull request twitter#89 from remotezygote/master
Browse files Browse the repository at this point in the history
Adds support for DUMP/RESTORE commands in Redis
  • Loading branch information
manjuraj committed Apr 15, 2013
2 parents 839e360 + 2a1b046 commit c701528
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/nc_message.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ typedef enum msg_type {
MSG_REQ_REDIS_BITCOUNT,
MSG_REQ_REDIS_DECR,
MSG_REQ_REDIS_DECRBY,
MSG_REQ_REDIS_DUMP,
MSG_REQ_REDIS_GET,
MSG_REQ_REDIS_GETBIT,
MSG_REQ_REDIS_GETRANGE,
Expand All @@ -80,6 +81,7 @@ typedef enum msg_type {
MSG_REQ_REDIS_INCRBYFLOAT,
MSG_REQ_REDIS_MGET,
MSG_REQ_REDIS_PSETEX,
MSG_REQ_REDIS_RESTORE,
MSG_REQ_REDIS_SET,
MSG_REQ_REDIS_SETBIT,
MSG_REQ_REDIS_SETEX,
Expand Down
13 changes: 13 additions & 0 deletions src/proto/nc_redis.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ redis_arg0(struct msg *r)
case MSG_REQ_REDIS_PTTL:
case MSG_REQ_REDIS_TTL:
case MSG_REQ_REDIS_TYPE:
case MSG_REQ_REDIS_DUMP:

case MSG_REQ_REDIS_DECR:
case MSG_REQ_REDIS_GET:
Expand Down Expand Up @@ -138,6 +139,8 @@ redis_arg2(struct msg *r)
case MSG_REQ_REDIS_ZINCRBY:
case MSG_REQ_REDIS_ZREMRANGEBYRANK:
case MSG_REQ_REDIS_ZREMRANGEBYSCORE:

case MSG_REQ_REDIS_RESTORE:
return true;

default:
Expand Down Expand Up @@ -458,6 +461,11 @@ redis_parse_req(struct msg *r)
break;
}

if (str4icmp(m, 'd', 'u', 'm', 'p')) {
r->type = MSG_REQ_REDIS_DUMP;
break;
}

if (str4icmp(m, 'h', 'd', 'e', 'l')) {
r->type = MSG_REQ_REDIS_HDEL;
break;
Expand Down Expand Up @@ -767,6 +775,11 @@ redis_parse_req(struct msg *r)
break;
}

if (str7icmp(m, 'r', 'e', 's', 't', 'o', 'r', 'e')) {
r->type = MSG_REQ_REDIS_RESTORE;
break;
}

break;

case 8:
Expand Down

0 comments on commit c701528

Please sign in to comment.