Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for publish #557

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion notes/redis.md
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
| PSUBSCRIBE | No | PSUBSCRIBE pattern [pattern ...] |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
| PUBLISH | No | PUBLISH channel message |
| PUBLISH | Yes | PUBLISH channel message |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
| PUNSUBSCRIBE | No | PUNSUBSCRIBE [pattern [pattern ...]] |
+-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
Expand Down
1 change: 1 addition & 0 deletions src/nc_message.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 ) \
Expand Down
7 changes: 7 additions & 0 deletions src/proto/nc_redis.c
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down