Class: EventMachine::Hiredis::Client
Instance Attribute Summary
Attributes inherited from BaseClient
#db, #host, #password, #port
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from BaseClient
#auth, #close_connection, #configure, #connect, #connected?, #initialize, #pending_commands?, #reconnect_connection, #select
#emit, #listeners, #on, #remove_all_listeners, #remove_listener
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
in the class EventMachine::Hiredis::BaseClient
Class Method Details
.connect(host = 'localhost', port = 6379) ⇒ Object
3
4
5
|
# File 'lib/em-hiredis/client.rb', line 3
def self.connect(host = 'localhost', port = 6379)
new(host, port).connect
end
|
Instance Method Details
#info ⇒ Object
12
13
14
15
16
17
18
19
20
21
22
23
24
|
# File 'lib/em-hiredis/client.rb', line 12
def info
df = method_missing(:info)
df.callback { |response|
info = {}
response.each_line do |line|
key, value = line.split(":", 2)
info[key.to_sym] = value.chomp
end
df.succeed(info)
}
df.callback { |info| yield info } if block_given?
df
end
|
#monitor(&blk) ⇒ Object
7
8
9
10
|
# File 'lib/em-hiredis/client.rb', line 7
def monitor(&blk)
@monitoring = true
method_missing(:monitor, &blk)
end
|
#psubscribe(channel) ⇒ Object
43
44
45
|
# File 'lib/em-hiredis/client.rb', line 43
def psubscribe(channel)
raise "Use pubsub client"
end
|
#pubsub ⇒ Object
Gives access to a richer interface for pubsub subscriptions on a separate redis connection
29
30
31
32
33
|
# File 'lib/em-hiredis/client.rb', line 29
def pubsub
@pubsub ||= begin
PubsubClient.new(@host, @port, @password, @db).connect
end
end
|
#punsubscribe(channel) ⇒ Object
47
48
49
|
# File 'lib/em-hiredis/client.rb', line 47
def punsubscribe(channel)
raise "Use pubsub client"
end
|
#subscribe(*channels) ⇒ Object
35
36
37
|
# File 'lib/em-hiredis/client.rb', line 35
def subscribe(*channels)
raise "Use pubsub client"
end
|
#unsubscribe(*channels) ⇒ Object
39
40
41
|
# File 'lib/em-hiredis/client.rb', line 39
def unsubscribe(*channels)
raise "Use pubsub client"
end
|