Browse files

RPOPLPUSH, Set, and Sorted Set Operation Support (@dcartoon)

  • Loading branch information...
1 parent a635844 commit 5144e0c94b39b39aa377f6efb37123aa2056e730 Manju Rajashekhar committed Jan 30, 2013
Showing with 165 additions and 10 deletions.
  1. +10 −10 notes/redis.md
  2. +83 −0 scripts/redis-check.sh
  3. +10 −0 src/nc_message.h
  4. +62 −0 src/proto/nc_redis.c
View
20 notes/redis.md
@@ -161,7 +161,7 @@
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
| RPOP | Yes | RPOP key |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
- | RPOPLPUSH | No | RPOPLPUSH source destination |
+ | RPOPLPUSH | Yes* | RPOPLPUSH source destination |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
| RPUSH | Yes | RPUSH key value [value ...] |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
@@ -177,29 +177,29 @@
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
| SCARD | Yes | SCARD key |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
- | SDIFF | No | SDIFF key [key ...] |
+ | SDIFF | Yes* | SDIFF key [key ...] |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
- | SDIFFSTORE | No | SDIFFSTORE destination key [key ...] |
+ | SDIFFSTORE | Yes* | SDIFFSTORE destination key [key ...] |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
- | SINTER | No | SINTER key [key ...] |
+ | SINTER | Yes* | SINTER key [key ...] |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
- | SINTERSTORE | No | SINTERSTORE destination key [key ...] |
+ | SINTERSTORE | Yes* | SINTERSTORE destination key [key ...] |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
| SISMEMBER | Yes | SISMEMBER key member |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
| SMEMBERS | Yes | SMEMBERS key |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
- | SMOVE | No | SMOVE source destination member |
+ | SMOVE | Yes* | SMOVE source destination member |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
| SPOP | Yes | SPOP key |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
| SRANDMEMBER | Yes | SRANDMEMBER key |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
| SREM | Yes | SREM key member [member ...] |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
- | SUNION | No | SUNION key [key ...] |
+ | SUNION | Yes* | SUNION key [key ...] |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
- | SUNIONSTORE | No | SUNIONSTORE destination key [key ...] |
+ | SUNIONSTORE | Yes* | SUNIONSTORE destination key [key ...] |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
### Sorted Sets
@@ -215,7 +215,7 @@
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
| ZINCRBY | Yes | ZINCRBY key increment member |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
- | ZINTERSTORE | No | ZINTERSTORE destination numkeys key [key ...] [WEIGHTS weight [weight ...]] [AGGREGATE SUM|MIN|MAX] |
+ | ZINTERSTORE | Yes* | ZINTERSTORE destination numkeys key [key ...] [WEIGHTS weight [weight ...]] [AGGREGATE SUM|MIN|MAX] |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
| ZRANGE | Yes | ZRANGE key start stop [WITHSCORES] |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
@@ -237,7 +237,7 @@
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
| ZSCORE | Yes | ZSCORE key member |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
- | ZUNIONSTORE | No | ZUNIONSTORE destination numkeys key [key ...] [WEIGHTS weight [weight ...]] [AGGREGATE SUM|MIN|MAX] |
+ | ZUNIONSTORE | Yes* | ZUNIONSTORE destination numkeys key [key ...] [WEIGHTS weight [weight ...]] [AGGREGATE SUM|MIN|MAX] |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
### Pub/Sub
View
83 scripts/redis-check.sh 100644 → 100755
@@ -320,6 +320,15 @@ printf '*2\r\n$4\r\nrpop\r\n$4\r\nlfoo\r\n' | socat ${debug} ${timeout} - TCP:lo
printf '*2\r\n$4\r\nrpop\r\n$4\r\nlfoo\r\n' | socat ${debug} ${timeout} - TCP:localhost:${port},shut-close
printf '*2\r\n$4\r\nrpop\r\n$4\r\nlfoo\r\n' | socat ${debug} ${timeout} - TCP:localhost:${port},shut-close
+printf '\nrpoplpush\n'
+printf '*2\r\n$3\r\ndel\r\n$6\r\n{lfoo}\r\n' | socat ${debug} ${timeout} - TCP:localhost:${port},shut-close
+printf '*2\r\n$3\r\ndel\r\n$7\r\n{lfoo}2\r\n' | socat ${debug} ${timeout} - TCP:localhost:${port},shut-close
+printf '*5\r\n$5\r\nlpush\r\n$6\r\n{lfoo}\r\n$3\r\nbar\r\n$3\r\nbaq\r\n$3\r\nbap\r\n' | socat ${debug} ${timeout} - TCP:localhost:${port},shut-close
+printf '*3\r\n$9\r\nrpoplpush\r\n$6\r\n{lfoo}\r\n$7\r\n{lfoo}2\r\n' | socat ${debug} ${timeout} - TCP:localhost:${port},shut-close
+printf '*3\r\n$9\r\nrpoplpush\r\n$6\r\n{lfoo}\r\n$7\r\n{lfoo}2\r\n' | socat ${debug} ${timeout} - TCP:localhost:${port},shut-close
+printf '*4\r\n$6\r\nlrange\r\n$6\r\n{lfoo}\r\n$1\r\n0\r\n$1\r\n3\r\n' | socat ${debug} ${timeout} - TCP:localhost:${port},shut-close
+printf '*4\r\n$6\r\nlrange\r\n$7\r\n{lfoo}2\r\n$1\r\n0\r\n$1\r\n3\r\n' | socat ${debug} ${timeout} - TCP:localhost:${port},shut-close
+
printf '\nrpush\n'
printf '*2\r\n$3\r\ndel\r\n$4\r\nlfoo\r\n' | socat ${debug} ${timeout} - TCP:localhost:${port},shut-close
printf '*3\r\n$5\r\nrpush\r\n$4\r\nlfoo\r\n$3\r\nbar\r\n' | socat ${debug} ${timeout} - TCP:localhost:${port},shut-close
@@ -348,6 +357,38 @@ printf '*2\r\n$5\r\nscard\r\n$4\r\nsfoo\r\n' | socat ${debug} ${timeout} - TCP:l
printf '*4\r\n$4\r\nsadd\r\n$4\r\nsfoo\r\n$3\r\nbar\r\n$3\r\nbas\r\n' | socat ${debug} ${timeout} - TCP:localhost:${port},shut-close
printf '*2\r\n$5\r\nscard\r\n$4\r\nsfoo\r\n' | socat ${debug} ${timeout} - TCP:localhost:${port},shut-close
+printf '\nsdiff\n'
+printf '*2\r\n$3\r\ndel\r\n$6\r\n{sfoo}\r\n' | socat ${debug} ${timeout} - TCP:localhost:${port},shut-close
+printf '*2\r\n$3\r\ndel\r\n$7\r\n{sfoo}2\r\n' | socat ${debug} ${timeout} - TCP:localhost:${port},shut-close
+printf '*4\r\n$4\r\nsadd\r\n$6\r\n{sfoo}\r\n$3\r\nbar\r\n$3\r\nbas\r\n' | socat ${debug} ${timeout} - TCP:localhost:${port},shut-close
+printf '*3\r\n$4\r\nsadd\r\n$7\r\n{sfoo}2\r\n$3\r\nbar\r\n' | socat ${debug} ${timeout} - TCP:localhost:${port},shut-close
+printf '*3\r\n$5\r\nsdiff\r\n$6\r\n{sfoo}\r\n$7\r\n{sfoo}2\r\n' | socat ${debug} ${timeout} - TCP:localhost:${port},shut-close
+
+printf '\nsdiffstore\n'
+printf '*2\r\n$3\r\ndel\r\n$6\r\n{sfoo}\r\n' | socat ${debug} ${timeout} - TCP:localhost:${port},shut-close
+printf '*2\r\n$3\r\ndel\r\n$7\r\n{sfoo}2\r\n' | socat ${debug} ${timeout} - TCP:localhost:${port},shut-close
+printf '*2\r\n$3\r\ndel\r\n$7\r\n{sfoo}3\r\n' | socat ${debug} ${timeout} - TCP:localhost:${port},shut-close
+printf '*4\r\n$4\r\nsadd\r\n$6\r\n{sfoo}\r\n$3\r\nbar\r\n$3\r\nbas\r\n' | socat ${debug} ${timeout} - TCP:localhost:${port},shut-close
+printf '*3\r\n$4\r\nsadd\r\n$7\r\n{sfoo}2\r\n$3\r\nbar\r\n' | socat ${debug} ${timeout} - TCP:localhost:${port},shut-close
+printf '*4\r\n$10\r\nsdiffstore\r\n$7\r\n{sfoo}3\r\n$6\r\n{sfoo}\r\n$7\r\n{sfoo}2\r\n' | socat ${debug} ${timeout} - TCP:localhost:${port},shut-close
+printf '*2\r\n$8\r\nsmembers\r\n$7\r\n{sfoo}3\r\n' | socat ${debug} ${timeout} - TCP:localhost:${port},shut-close
+
+printf '\nsinter\n'
+printf '*2\r\n$3\r\ndel\r\n$6\r\n{sfoo}\r\n' | socat ${debug} ${timeout} - TCP:localhost:${port},shut-close
+printf '*2\r\n$3\r\ndel\r\n$7\r\n{sfoo}2\r\n' | socat ${debug} ${timeout} - TCP:localhost:${port},shut-close
+printf '*4\r\n$4\r\nsadd\r\n$6\r\n{sfoo}\r\n$3\r\nbar\r\n$3\r\nbas\r\n' | socat ${debug} ${timeout} - TCP:localhost:${port},shut-close
+printf '*3\r\n$4\r\nsadd\r\n$7\r\n{sfoo}2\r\n$3\r\nbar\r\n' | socat ${debug} ${timeout} - TCP:localhost:${port},shut-close
+printf '*3\r\n$6\r\nsinter\r\n$6\r\n{sfoo}\r\n$7\r\n{sfoo}2\r\n' | socat ${debug} ${timeout} - TCP:localhost:${port},shut-close
+
+printf '\nsinterstore\n'
+printf '*2\r\n$3\r\ndel\r\n$6\r\n{sfoo}\r\n' | socat ${debug} ${timeout} - TCP:localhost:${port},shut-close
+printf '*2\r\n$3\r\ndel\r\n$7\r\n{sfoo}2\r\n' | socat ${debug} ${timeout} - TCP:localhost:${port},shut-close
+printf '*2\r\n$3\r\ndel\r\n$7\r\n{sfoo}3\r\n' | socat ${debug} ${timeout} - TCP:localhost:${port},shut-close
+printf '*4\r\n$4\r\nsadd\r\n$6\r\n{sfoo}\r\n$3\r\nbar\r\n$3\r\nbas\r\n' | socat ${debug} ${timeout} - TCP:localhost:${port},shut-close
+printf '*3\r\n$4\r\nsadd\r\n$7\r\n{sfoo}2\r\n$3\r\nbar\r\n' | socat ${debug} ${timeout} - TCP:localhost:${port},shut-close
+printf '*4\r\n$11\r\nsinterstore\r\n$7\r\n{sfoo}3\r\n$6\r\n{sfoo}\r\n$7\r\n{sfoo}2\r\n' | socat ${debug} ${timeout} - TCP:localhost:${port},shut-close
+printf '*2\r\n$8\r\nsmembers\r\n$7\r\n{sfoo}3\r\n' | socat ${debug} ${timeout} - TCP:localhost:${port},shut-close
+
printf '\nsismember\n'
printf '*2\r\n$3\r\ndel\r\n$4\r\nsfoo\r\n' | socat ${debug} ${timeout} - TCP:localhost:${port},shut-close
printf '*3\r\n$9\r\nsismember\r\n$4\r\nsfoo\r\n$3\r\nbar\r\n' | socat ${debug} ${timeout} - TCP:localhost:${port},shut-close
@@ -361,6 +402,14 @@ printf '*2\r\n$8\r\nsmembers\r\n$4\r\nsfoo\r\n' | socat ${debug} ${timeout} - TC
printf '*4\r\n$4\r\nsadd\r\n$4\r\nsfoo\r\n$3\r\nbar\r\n$3\r\nbas\r\n' | socat ${debug} ${timeout} - TCP:localhost:${port},shut-close
printf '*2\r\n$8\r\nsmembers\r\n$4\r\nsfoo\r\n' | socat ${debug} ${timeout} - TCP:localhost:${port},shut-close
+printf '\nsmove\n'
+printf '*2\r\n$3\r\ndel\r\n$6\r\n{sfoo}\r\n' | socat ${debug} ${timeout} - TCP:localhost:${port},shut-close
+printf '*2\r\n$3\r\ndel\r\n$7\r\n{sfoo}2\r\n' | socat ${debug} ${timeout} - TCP:localhost:${port},shut-close
+printf '*4\r\n$4\r\nsadd\r\n$6\r\n{sfoo}\r\n$3\r\nbar\r\n$3\r\nbas\r\n' | socat ${debug} ${timeout} - TCP:localhost:${port},shut-close
+printf '*4\r\n$5\r\nsmove\r\n$6\r\n{sfoo}\r\n$7\r\n{sfoo}2\r\n$3\r\nbas\r\n' | socat ${debug} ${timeout} - TCP:localhost:${port},shut-close
+printf '*2\r\n$8\r\nsmembers\r\n$6\r\n{sfoo}\r\n' | socat ${debug} ${timeout} - TCP:localhost:${port},shut-close
+printf '*2\r\n$8\r\nsmembers\r\n$7\r\n{sfoo}2\r\n' | socat ${debug} ${timeout} - TCP:localhost:${port},shut-close
+
printf '\nspop\n'
printf '*2\r\n$3\r\ndel\r\n$4\r\nsfoo\r\n' | socat ${debug} ${timeout} - TCP:localhost:${port},shut-close
printf '*2\r\n$4\r\nspop\r\n$4\r\nsfoo\r\n' | socat ${debug} ${timeout} - TCP:localhost:${port},shut-close
@@ -382,6 +431,22 @@ printf '*5\r\n$4\r\nsadd\r\n$4\r\nsfoo\r\n$3\r\nbar\r\n$3\r\nbas\r\n$3\r\nbat\r\
printf '*3\r\n$4\r\nsrem\r\n$4\r\nsfoo\r\n$3\r\nbar\r\n' | socat ${debug} ${timeout} - TCP:localhost:${port},shut-close
printf '*5\r\n$4\r\nsrem\r\n$4\r\nsfoo\r\n$3\r\nbas\r\n$3\r\nbat\r\n$3\r\nrab\r\n' | socat ${debug} ${timeout} - TCP:localhost:${port},shut-close
+printf '\nsunion\n'
+printf '*2\r\n$3\r\ndel\r\n$6\r\n{sfoo}\r\n' | socat ${debug} ${timeout} - TCP:localhost:${port},shut-close
+printf '*2\r\n$3\r\ndel\r\n$7\r\n{sfoo}2\r\n' | socat ${debug} ${timeout} - TCP:localhost:${port},shut-close
+printf '*4\r\n$4\r\nsadd\r\n$6\r\n{sfoo}\r\n$3\r\nbar\r\n$3\r\nbas\r\n' | socat ${debug} ${timeout} - TCP:localhost:${port},shut-close
+printf '*3\r\n$4\r\nsadd\r\n$7\r\n{sfoo}2\r\n$3\r\nbar\r\n' | socat ${debug} ${timeout} - TCP:localhost:${port},shut-close
+printf '*3\r\n$6\r\nsunion\r\n$6\r\n{sfoo}\r\n$7\r\n{sfoo}2\r\n' | socat ${debug} ${timeout} - TCP:localhost:${port},shut-close
+
+printf '\nsunionstore\n'
+printf '*2\r\n$3\r\ndel\r\n$6\r\n{sfoo}\r\n' | socat ${debug} ${timeout} - TCP:localhost:${port},shut-close
+printf '*2\r\n$3\r\ndel\r\n$7\r\n{sfoo}2\r\n' | socat ${debug} ${timeout} - TCP:localhost:${port},shut-close
+printf '*2\r\n$3\r\ndel\r\n$7\r\n{sfoo}3\r\n' | socat ${debug} ${timeout} - TCP:localhost:${port},shut-close
+printf '*4\r\n$4\r\nsadd\r\n$6\r\n{sfoo}\r\n$3\r\nbar\r\n$3\r\nbas\r\n' | socat ${debug} ${timeout} - TCP:localhost:${port},shut-close
+printf '*3\r\n$4\r\nsadd\r\n$7\r\n{sfoo}2\r\n$3\r\nbar\r\n' | socat ${debug} ${timeout} - TCP:localhost:${port},shut-close
+printf '*4\r\n$11\r\nsunionstore\r\n$7\r\n{sfoo}3\r\n$6\r\n{sfoo}\r\n$7\r\n{sfoo}2\r\n' | socat ${debug} ${timeout} - TCP:localhost:${port},shut-close
+printf '*2\r\n$8\r\nsmembers\r\n$7\r\n{sfoo}3\r\n' | socat ${debug} ${timeout} - TCP:localhost:${port},shut-close
+
# sorted sets
printf '\nzadd\n'
@@ -408,6 +473,15 @@ printf '*2\r\n$3\r\ndel\r\n$4\r\nzfoo\r\n' | socat ${debug} ${timeout} - TCP:loc
printf '*4\r\n$7\r\nzincrby\r\n$4\r\nzfoo\r\n$3\r\n100\r\n$3\r\nbar\r\n' | socat ${debug} ${timeout} - TCP:localhost:${port},shut-close
printf '*4\r\n$7\r\nzincrby\r\n$4\r\nzfoo\r\n$3\r\n100\r\n$3\r\nbar\r\n' | socat ${debug} ${timeout} - TCP:localhost:${port},shut-close
+printf '\nzinterstore\n'
+printf '*2\r\n$3\r\ndel\r\n$6\r\n{zfoo}\r\n' | socat ${debug} ${timeout} - TCP:localhost:${port},shut-close
+printf '*2\r\n$3\r\ndel\r\n$7\r\n{zfoo}2\r\n' | socat ${debug} ${timeout} - TCP:localhost:${port},shut-close
+printf '*2\r\n$3\r\ndel\r\n$7\r\n{zfoo}3\r\n' | socat ${debug} ${timeout} - TCP:localhost:${port},shut-close
+printf '*8\r\n$4\r\nzadd\r\n$6\r\n{zfoo}\r\n$3\r\n100\r\n$3\r\nbar\r\n$3\r\n101\r\n$3\r\nbat\r\n$3\r\n102\r\n$3\r\nbau\r\n' | socat ${debug} ${timeout} - TCP:localhost:${port},shut-close
+printf '*6\r\n$4\r\nzadd\r\n$7\r\n{zfoo}2\r\n$3\r\n100\r\n$3\r\nbar\r\n$3\r\n101\r\n$3\r\nbat\r\n' | socat ${debug} ${timeout} - TCP:localhost:${port},shut-close
+printf '*5\r\n$11\r\nzinterstore\r\n$7\r\n{zfoo}3\r\n$1\r\n2\r\n$6\r\n{zfoo}\r\n$7\r\n{zfoo}2\r\n' | socat ${debug} ${timeout} - TCP:localhost:${port},shut-close
+printf '*5\r\n$6\r\nzrange\r\n$7\r\n{zfoo}3\r\n$1\r\n0\r\n$1\r\n3\r\n$10\r\nWITHSCORES\r\n' | socat ${debug} ${timeout} - TCP:localhost:${port},shut-close
+
printf '\nzrange\n'
printf '*2\r\n$3\r\ndel\r\n$4\r\nzfoo\r\n' | socat ${debug} ${timeout} - TCP:localhost:${port},shut-close
printf '*4\r\n$6\r\nzrange\r\n$4\r\nzfoo\r\n$1\r\n0\r\n$1\r\n3\r\n' | socat ${debug} ${timeout} - TCP:localhost:${port},shut-close
@@ -469,6 +543,15 @@ printf '*3\r\n$6\r\nzscore\r\n$4\r\nzfoo\r\n$3\r\nbar\r\n' | socat ${debug} ${ti
printf '*8\r\n$4\r\nzadd\r\n$4\r\nzfoo\r\n$3\r\n100\r\n$3\r\nbar\r\n$3\r\n101\r\n$3\r\nbat\r\n$3\r\n102\r\n$3\r\nbau\r\n' | socat ${debug} ${timeout} - TCP:localhost:${port},shut-close
printf '*3\r\n$6\r\nzscore\r\n$4\r\nzfoo\r\n$3\r\nbar\r\n' | socat ${debug} ${timeout} - TCP:localhost:${port},shut-close
+printf '\nzunionstore\n'
+printf '*2\r\n$3\r\ndel\r\n$6\r\n{zfoo}\r\n' | socat ${debug} ${timeout} - TCP:localhost:${port},shut-close
+printf '*2\r\n$3\r\ndel\r\n$7\r\n{zfoo}2\r\n' | socat ${debug} ${timeout} - TCP:localhost:${port},shut-close
+printf '*2\r\n$3\r\ndel\r\n$7\r\n{zfoo}3\r\n' | socat ${debug} ${timeout} - TCP:localhost:${port},shut-close
+printf '*8\r\n$4\r\nzadd\r\n$6\r\n{zfoo}\r\n$3\r\n100\r\n$3\r\nbar\r\n$3\r\n101\r\n$3\r\nbat\r\n$3\r\n102\r\n$3\r\nbau\r\n' | socat ${debug} ${timeout} - TCP:localhost:${port},shut-close
+printf '*6\r\n$4\r\nzadd\r\n$7\r\n{zfoo}2\r\n$3\r\n100\r\n$3\r\nbar\r\n$3\r\n101\r\n$3\r\nbat\r\n' | socat ${debug} ${timeout} - TCP:localhost:${port},shut-close
+printf '*5\r\n$11\r\nzunionstore\r\n$7\r\n{zfoo}3\r\n$1\r\n2\r\n$6\r\n{zfoo}\r\n$7\r\n{zfoo}2\r\n' | socat ${debug} ${timeout} - TCP:localhost:${port},shut-close
+printf '*5\r\n$6\r\nzrange\r\n$7\r\n{zfoo}3\r\n$1\r\n0\r\n$1\r\n3\r\n$10\r\nWITHSCORES\r\n' | socat ${debug} ${timeout} - TCP:localhost:${port},shut-close
+
# scripting
printf '*2\r\n$4\r\neval\r\n$10\r\nreturn 123\r\n' | socat ${debug} ${timeout} - TCP:localhost:${port},shut-close
View
10 src/nc_message.h
@@ -110,19 +110,28 @@ typedef enum msg_type {
MSG_REQ_REDIS_LSET,
MSG_REQ_REDIS_LTRIM,
MSG_REQ_REDIS_RPOP,
+ MSG_REQ_REDIS_RPOPLPUSH,
MSG_REQ_REDIS_RPUSH,
MSG_REQ_REDIS_RPUSHX,
MSG_REQ_REDIS_SADD, /* redis requests - sets */
MSG_REQ_REDIS_SCARD,
+ MSG_REQ_REDIS_SDIFF,
+ MSG_REQ_REDIS_SDIFFSTORE,
+ MSG_REQ_REDIS_SINTER,
+ MSG_REQ_REDIS_SINTERSTORE,
MSG_REQ_REDIS_SISMEMBER,
MSG_REQ_REDIS_SMEMBERS,
+ MSG_REQ_REDIS_SMOVE,
MSG_REQ_REDIS_SPOP,
MSG_REQ_REDIS_SRANDMEMBER,
MSG_REQ_REDIS_SREM,
+ MSG_REQ_REDIS_SUNION,
+ MSG_REQ_REDIS_SUNIONSTORE,
MSG_REQ_REDIS_ZADD, /* redis requests - sorted sets */
MSG_REQ_REDIS_ZCARD,
MSG_REQ_REDIS_ZCOUNT,
MSG_REQ_REDIS_ZINCRBY,
+ MSG_REQ_REDIS_ZINTERSTORE,
MSG_REQ_REDIS_ZRANGE,
MSG_REQ_REDIS_ZRANGEBYSCORE,
MSG_REQ_REDIS_ZRANK,
@@ -133,6 +142,7 @@ typedef enum msg_type {
MSG_REQ_REDIS_ZREVRANGEBYSCORE,
MSG_REQ_REDIS_ZREVRANK,
MSG_REQ_REDIS_ZSCORE,
+ MSG_REQ_REDIS_ZUNIONSTORE,
MSG_REQ_REDIS_EVAL, /* redis requests - eval */
MSG_REQ_REDIS_EVALSHA,
MSG_RSP_REDIS_STATUS, /* redis response */
View
62 src/proto/nc_redis.c
@@ -91,6 +91,7 @@ redis_arg1(struct msg *r)
case MSG_REQ_REDIS_LINDEX:
case MSG_REQ_REDIS_LPUSHX:
+ case MSG_REQ_REDIS_RPOPLPUSH:
case MSG_REQ_REDIS_RPUSHX:
case MSG_REQ_REDIS_SISMEMBER:
@@ -131,6 +132,8 @@ redis_arg2(struct msg *r)
case MSG_REQ_REDIS_LSET:
case MSG_REQ_REDIS_LTRIM:
+ case MSG_REQ_REDIS_SMOVE:
+
case MSG_REQ_REDIS_ZCOUNT:
case MSG_REQ_REDIS_ZINCRBY:
case MSG_REQ_REDIS_ZREMRANGEBYRANK:
@@ -180,14 +183,22 @@ redis_argn(struct msg *r)
case MSG_REQ_REDIS_RPUSH:
case MSG_REQ_REDIS_SADD:
+ case MSG_REQ_REDIS_SDIFF:
+ case MSG_REQ_REDIS_SDIFFSTORE:
+ case MSG_REQ_REDIS_SINTER:
+ case MSG_REQ_REDIS_SINTERSTORE:
case MSG_REQ_REDIS_SREM:
+ case MSG_REQ_REDIS_SUNION:
+ case MSG_REQ_REDIS_SUNIONSTORE:
case MSG_REQ_REDIS_ZADD:
+ case MSG_REQ_REDIS_ZINTERSTORE:
case MSG_REQ_REDIS_ZRANGE:
case MSG_REQ_REDIS_ZRANGEBYSCORE:
case MSG_REQ_REDIS_ZREM:
case MSG_REQ_REDIS_ZREVRANGE:
case MSG_REQ_REDIS_ZREVRANGEBYSCORE:
+ case MSG_REQ_REDIS_ZUNIONSTORE:
return true;
default:
@@ -580,6 +591,11 @@ redis_parse_req(struct msg *r)
break;
}
+ if (str5icmp(m, 's', 'd', 'i', 'f', 'f')) {
+ r->type = MSG_REQ_REDIS_SDIFF;
+ break;
+ }
+
if (str5icmp(m, 's', 'e', 't', 'e', 'x')) {
r->type = MSG_REQ_REDIS_SETEX;
break;
@@ -590,6 +606,11 @@ redis_parse_req(struct msg *r)
break;
}
+ if (str5icmp(m, 's', 'm', 'o', 'v', 'e')) {
+ r->type = MSG_REQ_REDIS_SMOVE;
+ break;
+ }
+
if (str5icmp(m, 'z', 'c', 'a', 'r', 'd')) {
r->type = MSG_REQ_REDIS_ZCARD;
break;
@@ -673,11 +694,21 @@ redis_parse_req(struct msg *r)
break;
}
+ if (str6icmp(m, 's', 'i', 'n', 't', 'e', 'r')) {
+ r->type = MSG_REQ_REDIS_SINTER;
+ break;
+ }
+
if (str6icmp(m, 's', 't', 'r', 'l', 'e', 'n')) {
r->type = MSG_REQ_REDIS_STRLEN;
break;
}
+ if (str6icmp(m, 's', 'u', 'n', 'i', 'o', 'n')) {
+ r->type = MSG_REQ_REDIS_SUNION;
+ break;
+ }
+
if (str6icmp(m, 'z', 'c', 'o', 'u', 'n', 't')) {
r->type = MSG_REQ_REDIS_ZCOUNT;
break;
@@ -777,6 +808,11 @@ redis_parse_req(struct msg *r)
break;
}
+ if (str9icmp(m, 'r', 'p', 'o', 'p', 'l', 'p', 'u', 's', 'h')) {
+ r->type = MSG_REQ_REDIS_RPOPLPUSH;
+ break;
+ }
+
if (str9icmp(m, 's', 'i', 's', 'm', 'e', 'm', 'b', 'e', 'r')) {
r->type = MSG_REQ_REDIS_SISMEMBER;
break;
@@ -789,17 +825,43 @@ redis_parse_req(struct msg *r)
break;
+ case 10:
+ if (str10icmp(m, 's', 'd', 'i', 'f', 'f', 's', 't', 'o', 'r', 'e')) {
+ r->type = MSG_REQ_REDIS_SDIFFSTORE;
+ break;
+ }
+
case 11:
if (str11icmp(m, 'i', 'n', 'c', 'r', 'b', 'y', 'f', 'l', 'o', 'a', 't')) {
r->type = MSG_REQ_REDIS_INCRBYFLOAT;
break;
}
+ if (str11icmp(m, 's', 'i', 'n', 't', 'e', 'r', 's', 't', 'o', 'r', 'e')) {
+ r->type = MSG_REQ_REDIS_SINTERSTORE;
+ break;
+ }
+
if (str11icmp(m, 's', 'r', 'a', 'n', 'd', 'm', 'e', 'm', 'b', 'e', 'r')) {
r->type = MSG_REQ_REDIS_SRANDMEMBER;
break;
}
+ if (str11icmp(m, 's', 'u', 'n', 'i', 'o', 'n', 's', 't', 'o', 'r', 'e')) {
+ r->type = MSG_REQ_REDIS_SUNIONSTORE;
+ break;
+ }
+
+ if (str11icmp(m, 'z', 'i', 'n', 't', 'e', 'r', 's', 't', 'o', 'r', 'e')) {
+ r->type = MSG_REQ_REDIS_ZINTERSTORE;
+ break;
+ }
+
+ if (str11icmp(m, 'z', 'u', 'n', 'i', 'o', 'n', 's', 't', 'o', 'r', 'e')) {
+ r->type = MSG_REQ_REDIS_ZUNIONSTORE;
+ break;
+ }
+
break;
case 12:

0 comments on commit 5144e0c

Please sign in to comment.