class Generic
Base class for Redis command execution contexts.
Definitionsdef initialize(pool, *arguments)
Initialize a new generic context.
Signaturepool
Pool
The connection pool to use.
arguments
Array
Additional arguments for the context.
def initialize(pool, *arguments)
@pool = pool
@connection = pool.acquire
end
def close
Close the context and release the connection back to the pool.
Implementationdef close
if @connection
@pool.release(@connection)
@connection = nil
end
end
def write_request(command, *arguments)
Write a Redis command request to the connection.
Signaturecommand
String
The Redis command.
arguments
Array
The command arguments.
def write_request(command, *arguments)
@connection.write_request([command, *arguments])
end
def read_response
Read a response from the Redis connection.
SignatureObject
The Redis response.
def read_response
@connection.flush
return @connection.read_response
end
def call(command, *arguments)
Execute a Redis command and return the response.
Signaturecommand
String
The Redis command.
arguments
Array
The command arguments.
Object
The Redis response.
def call(command, *arguments)
write_request(command, *arguments)
return read_response
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