Module: Valkey::Commands::Connection

Included in:
Valkey::Commands
Defined in:
lib/valkey/commands/connection.rb

Overview

This module contains commands related to connection management.

Instance Method Summary collapse

Instance Method Details

#auth(*args) ⇒ String

Authenticate to the server.

Parameters:

  • args (Array<String>)

    includes both username and password or only password

Returns:

  • (String)

    ‘OK`

See Also:



13
14
15
16
# File 'lib/valkey/commands/connection.rb', line 13

def auth(*args)
  # TODO:
  # send_command([:auth, *args])
end

#echo(value) ⇒ String

Echo the given string.

Parameters:

  • value (String)

Returns:

  • (String)


31
32
33
34
# File 'lib/valkey/commands/connection.rb', line 31

def echo(value)
  # TODO:
  # send_command([:echo, value])
end

#ping(message = nil) ⇒ String

Ping the server.

Parameters:

  • message (optional, String) (defaults to: nil)

Returns:

  • (String)

    ‘PONG`



22
23
24
25
# File 'lib/valkey/commands/connection.rb', line 22

def ping(message = nil)
  # TODO:
  # send_command([:ping, message].compact)
end

#quitString

Close the connection.

Returns:

  • (String)

    ‘OK`



48
49
50
51
52
53
54
55
56
# File 'lib/valkey/commands/connection.rb', line 48

def quit
  # TODO:
  # 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.

Parameters:

  • db (Integer)

    zero-based index of the DB to use (0 to 15)

Returns:

  • (String)

    ‘OK`



40
41
42
43
# File 'lib/valkey/commands/connection.rb', line 40

def select(db)
  # TODO:
  # send_command(RequestType::SELECT, [db.to_s])
end