diff --git a/notes/redis.md b/notes/redis.md index 1f5fefea..cfbbb446 100644 --- a/notes/redis.md +++ b/notes/redis.md @@ -287,7 +287,7 @@ +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+ | PSUBSCRIBE | No | PSUBSCRIBE pattern [pattern ...] | +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+ - | PUBLISH | No | PUBLISH channel message | + | PUBLISH | Yes | PUBLISH channel message | +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+ | PUNSUBSCRIBE | No | PUNSUBSCRIBE [pattern [pattern ...]] | +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+ diff --git a/src/nc_message.h b/src/nc_message.h index 2844c824..67115042 100644 --- a/src/nc_message.h +++ b/src/nc_message.h @@ -122,6 +122,7 @@ typedef enum msg_parse_result { ACTION( REQ_REDIS_PFADD ) /* redis requests - hyperloglog */ \ ACTION( REQ_REDIS_PFCOUNT ) \ ACTION( REQ_REDIS_PFMERGE ) \ + ACTION( REQ_REDIS_PUBLISH ) \ ACTION( REQ_REDIS_RPOP ) \ ACTION( REQ_REDIS_RPOPLPUSH ) \ ACTION( REQ_REDIS_RPUSH ) \ diff --git a/src/proto/nc_redis.c b/src/proto/nc_redis.c index 2db88882..c2bb4857 100644 --- a/src/proto/nc_redis.c +++ b/src/proto/nc_redis.c @@ -128,6 +128,8 @@ redis_arg1(struct msg *r) case MSG_REQ_REDIS_RPOPLPUSH: case MSG_REQ_REDIS_RPUSHX: + case MSG_REQ_REDIS_PUBLISH: + case MSG_REQ_REDIS_SISMEMBER: case MSG_REQ_REDIS_ZRANK: @@ -937,6 +939,11 @@ redis_parse_req(struct msg *r) break; } + if (str7icmp(m, 'p', 'u', 'b', 'l', 'i', 's', 'h')) { + r->type = MSG_REQ_REDIS_PUBLISH; + break; + } + break; case 8: