Class: Lite::Redis::PubSub
- Inherits:
-
Base
- Object
- Base
- Lite::Redis::PubSub
show all
- Defined in:
- lib/lite/redis/pub_sub.rb
Instance Attribute Summary
Attributes inherited from Base
#client
Instance Method Summary
collapse
Methods inherited from Base
#initialize, method_missing, #respond_to_method?, #respond_to_missing?
Instance Method Details
#match_subscribe(*channels, timeout: nil, &block) ⇒ Object
27
28
29
30
31
32
33
|
# File 'lib/lite/redis/pub_sub.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/pub_sub.rb', line 35
def match_unsubscribe(*channels)
client.punsubscribe(*channels)
end
|
#publish(channel, message) ⇒ Object
7
8
9
|
# File 'lib/lite/redis/pub_sub.rb', line 7
def publish(channel, message)
client.publish(channel, message)
end
|
#state(command, *args) ⇒ Object
39
40
41
|
# File 'lib/lite/redis/pub_sub.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/pub_sub.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/pub_sub.rb', line 11
def subscribed?
client.subscribed?
end
|
#unsubscribe(*channels) ⇒ Object
23
24
25
|
# File 'lib/lite/redis/pub_sub.rb', line 23
def unsubscribe(*channels)
client.unsubscribe(*channels)
end
|