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/Client/Methods/index.html below:

Async::Redis::Client::Methods

Methods module providing Redis-specific functionality.

Definitions def subscribe(*channels)

Subscribe to one or more channels for pub/sub messaging.

Signature
parameter channels Array(String)

The channels to subscribe to.

yields {|context| ...}

If a block is given, it will be executed within the subscription context.

parameter context Context::Subscribe

The subscription context.

returns Object

The result of the block if block given.

returns Context::Subscribe

The subscription context if no block given.

Implementation
def subscribe(*channels)
	context = Context::Subscribe.new(@pool, channels)
	
	return context unless block_given?
	
	begin
		yield context
	ensure
		context.close
	end
end
def transaction(&block)

Execute commands within a Redis transaction.

Signature
yields {|context| ...}

If a block is given, it will be executed within the transaction context.

parameter context Context::Transaction

The transaction context.

returns Object

The result of the block if block given.

returns Context::Transaction

Else if no block is given, returns the transaction context.

Implementation
def transaction(&block)
	context = Context::Transaction.new(@pool)
	
	return context unless block_given?
	
	begin
		yield context
	ensure
		context.close
	end
end
def pipeline(&block)

Execute commands in a pipeline for improved performance.

Signature
yields {|context| ...}

If a block is given, it will be executed within the pipeline context.

parameter context Context::Pipeline

The pipeline context.

returns Object

The result of the block if block given.

returns Context::Pipeline

The pipeline context if no block given.

Implementation
def pipeline(&block)
	context = Context::Pipeline.new(@pool)
	
	return context unless block_given?
	
	begin
		yield context
	ensure
		context.close
	end
end
def call(*arguments)

Execute a Redis command directly.

Signature
parameter arguments Array

The command and its arguments.

returns Object

The response from the Redis server.

Implementation
def call(*arguments)
	@pool.acquire do |connection|
		connection.write_request(arguments)
		
		connection.flush
		
		return connection.read_response
	end
end
def close

Close the client and all its connections.

Implementation
def close
	@pool.close
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