Module: Valkey::Commands::ConnectionCommands
- Included in:
- Valkey::Commands
- Defined in:
- lib/valkey/commands/connection_commands.rb
Overview
This module contains commands related to connection management.
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.
15 16 17 |
# File 'lib/valkey/commands/connection_commands.rb', line 15 def auth(*args) send_command(RequestType::AUTH, args) end |
#echo(value) ⇒ String
Echo the given string.
31 32 33 |
# File 'lib/valkey/commands/connection_commands.rb', line 31 def echo(value) send_command(RequestType::ECHO, [value]) end |
#ping(message = nil) ⇒ String
Ping the server.
23 24 25 |
# File 'lib/valkey/commands/connection_commands.rb', line 23 def ping( = nil) send_command(RequestType::PING, [].compact) end |
#quit ⇒ String
Close the connection.
46 47 48 49 50 51 52 53 54 |
# File 'lib/valkey/commands/connection_commands.rb', line 46 def quit # TODO: Implement a proper quit command # synchronize do |client| # client.call_v([:quit]) # rescue ConnectionError # ensure # client.close # end end |
#select(db) ⇒ String
Change the selected database for the current connection.
39 40 41 |
# File 'lib/valkey/commands/connection_commands.rb', line 39 def select(db) send_command(RequestType::SELECT, [db]) end |