Module: Redis::Commands::Connection

Defined in:
lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/redis-5.0.5/lib/redis/commands/connection.rb

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:

See Also:



12
13
14
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/redis-5.0.5/lib/redis/commands/connection.rb', line 12

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

#echo(value) ⇒ String

Echo the given string.

Parameters:

Returns:



28
29
30
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/redis-5.0.5/lib/redis/commands/connection.rb', line 28

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

#ping(message = nil) ⇒ String

Ping the server.

Parameters:

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

Returns:



20
21
22
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/redis-5.0.5/lib/redis/commands/connection.rb', line 20

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

#quitString

Close the connection.

Returns:



43
44
45
46
47
48
49
50
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/redis-5.0.5/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) ⇒ String

Change the selected database for the current connection.

Parameters:

  • db (Integer)

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

Returns:



36
37
38
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/redis-5.0.5/lib/redis/commands/connection.rb', line 36

def select(db)
  send_command([:select, db])
end