Module: Lite::Redis::PubSubHelper
Instance Method Summary collapse
- #match_subscribe(*channels, timeout: nil, &block) ⇒ Object
- #match_unsubscribe(*channels) ⇒ Object
- #publish(channel, message) ⇒ Object
- #state(command, *args) ⇒ Object
- #subscribe(*channels, timeout: nil, &block) ⇒ Object
- #subscribed? ⇒ Boolean
- #unsubscribe(*channels) ⇒ Object
Instance Method Details
#match_subscribe(*channels, timeout: nil, &block) ⇒ Object
27 28 29 30 31 32 33 |
# File 'lib/lite/redis/helpers/pub_sub_helper.rb', line 27 def match_subscribe(*channels, timeout: nil, &block) if timeout.nil? client.psubscribe(*channels, &block) else client.psubscribe_with_timeout(timeout, *channels, &block) end end |
#match_unsubscribe(*channels) ⇒ Object
35 36 37 |
# File 'lib/lite/redis/helpers/pub_sub_helper.rb', line 35 def match_unsubscribe(*channels) client.punsubscribe(*channels) end |
#publish(channel, message) ⇒ Object
7 8 9 |
# File 'lib/lite/redis/helpers/pub_sub_helper.rb', line 7 def publish(channel, ) client.publish(channel, ) end |
#state(command, *args) ⇒ Object
39 40 41 |
# File 'lib/lite/redis/helpers/pub_sub_helper.rb', line 39 def state(command, *args) client.pubsub(command, *args) end |
#subscribe(*channels, timeout: nil, &block) ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/lite/redis/helpers/pub_sub_helper.rb', line 15 def subscribe(*channels, timeout: nil, &block) if timeout.nil? client.subscribe(*channels, &block) else client.subscribe_with_timeout(timeout, *channels, &block) end end |
#subscribed? ⇒ Boolean
11 12 13 |
# File 'lib/lite/redis/helpers/pub_sub_helper.rb', line 11 def subscribed? client.subscribed? end |
#unsubscribe(*channels) ⇒ Object
23 24 25 |
# File 'lib/lite/redis/helpers/pub_sub_helper.rb', line 23 def unsubscribe(*channels) client.unsubscribe(*channels) end |