Class: Redis::Connection::Hiredis
- Inherits:
-
Object
- Object
- Redis::Connection::Hiredis
- Defined in:
- lib/redis/connection/hiredis.rb
Instance Method Summary collapse
- #connect(host, port, timeout) ⇒ Object
- #connect_unix(path, timeout) ⇒ Object
- #connected? ⇒ Boolean
- #disconnect ⇒ Object
-
#initialize ⇒ Hiredis
constructor
A new instance of Hiredis.
- #read ⇒ Object
- #timeout=(usecs) ⇒ Object
- #write(command) ⇒ Object
Constructor Details
#initialize ⇒ Hiredis
Returns a new instance of Hiredis.
8 9 10 |
# File 'lib/redis/connection/hiredis.rb', line 8 def initialize @connection = ::Hiredis::Connection.new end |
Instance Method Details
#connect(host, port, timeout) ⇒ Object
20 21 22 23 24 |
# File 'lib/redis/connection/hiredis.rb', line 20 def connect(host, port, timeout) @connection.connect(host, port, timeout) rescue Errno::ETIMEDOUT raise Timeout::Error end |
#connect_unix(path, timeout) ⇒ Object
26 27 28 29 30 |
# File 'lib/redis/connection/hiredis.rb', line 26 def connect_unix(path, timeout) @connection.connect_unix(path, timeout) rescue Errno::ETIMEDOUT raise Timeout::Error end |
#connected? ⇒ Boolean
12 13 14 |
# File 'lib/redis/connection/hiredis.rb', line 12 def connected? @connection.connected? end |
#disconnect ⇒ Object
32 33 34 |
# File 'lib/redis/connection/hiredis.rb', line 32 def disconnect @connection.disconnect end |
#read ⇒ Object
40 41 42 43 44 |
# File 'lib/redis/connection/hiredis.rb', line 40 def read @connection.read rescue RuntimeError => err raise ::Redis::ProtocolError.new(err.) end |
#timeout=(usecs) ⇒ Object
16 17 18 |
# File 'lib/redis/connection/hiredis.rb', line 16 def timeout=(usecs) @connection.timeout = usecs end |
#write(command) ⇒ Object
36 37 38 |
# File 'lib/redis/connection/hiredis.rb', line 36 def write(command) @connection.write(command) end |