Module: Redis::Commands::Connection
- Defined in:
- lib/redis/commands/connection.rb
Instance Method Summary collapse
-
#auth(*args) ⇒ String
Authenticate to the server.
-
#echo(value) ⇒ String
Echo the given string.
-
#ping(message = nil) ⇒ String
Ping the server.
-
#quit ⇒ String
Close the connection.
-
#select(db) ⇒ String
Change the selected database for the current connection.
Instance Method Details
#auth(*args) ⇒ String
Authenticate to the server.
12 13 14 |
# File 'lib/redis/commands/connection.rb', line 12 def auth(*args) send_command([:auth, *args]) end |
#echo(value) ⇒ String
Echo the given string.
28 29 30 |
# File 'lib/redis/commands/connection.rb', line 28 def echo(value) send_command([:echo, value]) end |
#ping(message = nil) ⇒ String
Ping the server.
20 21 22 |
# File 'lib/redis/commands/connection.rb', line 20 def ping( = nil) send_command([:ping, ].compact) end |
#quit ⇒ String
Close the connection.
46 47 48 49 50 51 52 53 54 55 |
# File 'lib/redis/commands/connection.rb', line 46 def quit synchronize do |client| begin client.call([:quit]) rescue ConnectionError ensure client.disconnect end end end |
#select(db) ⇒ String
Change the selected database for the current connection.
36 37 38 39 40 41 |
# File 'lib/redis/commands/connection.rb', line 36 def select(db) synchronize do |client| client.db = db client.call([:select, db]) end end |