A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://socketry.github.io/async-redis/source/Async/Redis/Protocol/Selected/index.html below:

Async::Redis::Protocol::Selected

Executes AUTH after the user has established a connection.

Definitions def initialize(index, protocol = Async::Redis::Protocol::RESP2)

Create a new authenticated protocol.

Signature
parameter index Integer

The database index to select.

parameter protocol Object

The delegated protocol for connecting.

Implementation
def initialize(index, protocol = Async::Redis::Protocol::RESP2)
	@index = index
	@protocol = protocol
end
def client(stream)

Create a new client and authenticate it.

Implementation
def client(stream)
	client = @protocol.client(stream)
	
	client.write_request(["SELECT", @index])
	response = client.read_response
	
	if response != "OK"
		raise SelectionError, "Could not select database: #{response}"
	end
	
	return client
end

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4