Class: Redis::SubscribedClient
- Inherits:
-
Object
- Object
- Redis::SubscribedClient
- Defined in:
- lib/redis/subscribe.rb
Instance Method Summary collapse
- #call_v(command) ⇒ Object
- #close ⇒ Object
-
#initialize(client) ⇒ SubscribedClient
constructor
A new instance of SubscribedClient.
- #psubscribe(*channels, &block) ⇒ Object
- #psubscribe_with_timeout(timeout, *channels, &block) ⇒ Object
- #punsubscribe(*channels) ⇒ Object
- #ssubscribe(*channels, &block) ⇒ Object
- #ssubscribe_with_timeout(timeout, *channels, &block) ⇒ Object
- #subscribe(*channels, &block) ⇒ Object
- #subscribe_with_timeout(timeout, *channels, &block) ⇒ Object
- #sunsubscribe(*channels) ⇒ Object
- #unsubscribe(*channels) ⇒ Object
Constructor Details
#initialize(client) ⇒ SubscribedClient
Returns a new instance of SubscribedClient.
5 6 7 8 |
# File 'lib/redis/subscribe.rb', line 5 def initialize(client) @client = client @write_monitor = Monitor.new end |
Instance Method Details
#call_v(command) ⇒ Object
10 11 12 13 14 |
# File 'lib/redis/subscribe.rb', line 10 def call_v(command) @write_monitor.synchronize do @client.call_v(command) end end |
#close ⇒ Object
52 53 54 |
# File 'lib/redis/subscribe.rb', line 52 def close @client.close end |
#psubscribe(*channels, &block) ⇒ Object
24 25 26 |
# File 'lib/redis/subscribe.rb', line 24 def psubscribe(*channels, &block) subscription("psubscribe", "punsubscribe", channels, block) end |
#psubscribe_with_timeout(timeout, *channels, &block) ⇒ Object
28 29 30 |
# File 'lib/redis/subscribe.rb', line 28 def psubscribe_with_timeout(timeout, *channels, &block) subscription("psubscribe", "punsubscribe", channels, block, timeout) end |
#punsubscribe(*channels) ⇒ Object
44 45 46 |
# File 'lib/redis/subscribe.rb', line 44 def punsubscribe(*channels) call_v([:punsubscribe, *channels]) end |
#ssubscribe(*channels, &block) ⇒ Object
32 33 34 |
# File 'lib/redis/subscribe.rb', line 32 def ssubscribe(*channels, &block) subscription("ssubscribe", "sunsubscribe", channels, block) end |
#ssubscribe_with_timeout(timeout, *channels, &block) ⇒ Object
36 37 38 |
# File 'lib/redis/subscribe.rb', line 36 def ssubscribe_with_timeout(timeout, *channels, &block) subscription("ssubscribe", "sunsubscribe", channels, block, timeout) end |
#subscribe(*channels, &block) ⇒ Object
16 17 18 |
# File 'lib/redis/subscribe.rb', line 16 def subscribe(*channels, &block) subscription("subscribe", "unsubscribe", channels, block) end |
#subscribe_with_timeout(timeout, *channels, &block) ⇒ Object
20 21 22 |
# File 'lib/redis/subscribe.rb', line 20 def subscribe_with_timeout(timeout, *channels, &block) subscription("subscribe", "unsubscribe", channels, block, timeout) end |
#sunsubscribe(*channels) ⇒ Object
48 49 50 |
# File 'lib/redis/subscribe.rb', line 48 def sunsubscribe(*channels) call_v([:sunsubscribe, *channels]) end |
#unsubscribe(*channels) ⇒ Object
40 41 42 |
# File 'lib/redis/subscribe.rb', line 40 def unsubscribe(*channels) call_v([:unsubscribe, *channels]) end |