module Redis::Commands::Connection

Public Instance Methods

auth(*args) click to toggle source

Authenticate to the server.

@param [Array<String>] args includes both username and password

or only password

@return [String] ‘OK` @see redis.io/commands/auth AUTH command

# File lib/redis/commands/connection.rb, line 12
def auth(*args)
  send_command([:auth, *args])
end
echo(value) click to toggle source

Echo the given string.

@param [String] value @return [String]

# File lib/redis/commands/connection.rb, line 28
def echo(value)
  send_command([:echo, value])
end
ping(message = nil) click to toggle source

Ping the server.

@param [optional, String] message @return [String] ‘PONG`

# File lib/redis/commands/connection.rb, line 20
def ping(message = nil)
  send_command([:ping, message].compact)
end
quit() click to toggle source

Close the connection.

@return [String] ‘OK`

# File lib/redis/commands/connection.rb, line 43
def quit
  synchronize do |client|
    client.call_v([:quit])
  rescue ConnectionError
  ensure
    client.close
  end
end
select(db) click to toggle source

Change the selected database for the current connection.

@param [Integer] db zero-based index of the DB to use (0 to 15) @return [String] ‘OK`

# File lib/redis/commands/connection.rb, line 36
def select(db)
  send_command([:select, db])
end