Skip to content

Commit 7f940db

Browse files
committed
Add spublish to Client.
1 parent d02d0de commit 7f940db

File tree

3 files changed

+20
-0
lines changed

3 files changed

+20
-0
lines changed

lib/protocol/redis/methods/pubsub.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,14 @@ module Pubsub
1515
def publish(channel, message)
1616
call("PUBLISH", channel, message)
1717
end
18+
19+
# Post a message to a shard channel.
20+
# See <https://redis.io/commands/spublish> for more details.
21+
# @parameter channel [String]
22+
# @parameter message [String]
23+
def spublish(channel, message)
24+
call("SPUBLISH", channel, message)
25+
end
1826
end
1927
end
2028
end

releases.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Releases
22

3+
## Unreleased
4+
5+
- Introduce `Pubsub#spublish` method for shard channels.
6+
37
## v0.11.0
48

59
- Introduce cluster methods, including `Strings`, `Streams`, `Scripting` and `Pubsub`.

test/protocol/redis/methods/pubsub.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,12 @@
1919
expect(object.publish(channel, message)).to be == 1
2020
end
2121
end
22+
23+
with "#spublish" do
24+
it "can generate correct arguments" do
25+
expect(object).to receive(:call).with("SPUBLISH", channel, message).and_return(1)
26+
27+
expect(object.spublish(channel, message)).to be == 1
28+
end
29+
end
2230
end

0 commit comments

Comments
 (0)