Pipeline
in package
implements
ClientContextInterface
Implementation of a command pipeline in which write and read operations of Redis commands are pipelined to alleviate the effects of network round-trips.
Tags
Interfaces, Classes, Traits and Enums
- ClientContextInterface
- Interface defining a client-side context such as a pipeline or transaction.
Table of Contents
- $client : mixed
- $pipeline : mixed
- $responses : mixed
- $running : mixed
- __call() : $this
- Queues a command into the pipeline buffer.
- __construct() : mixed
- execute() : array<string|int, mixed>
- Handles the actual execution of the whole pipeline.
- executeCommand() : $this
- Queues a command instance into the pipeline buffer.
- flushPipeline() : $this
- Flushes the buffer holding all of the commands queued so far.
- getClient() : ClientInterface
- Returns the underlying client instance used by the pipeline object.
- exception() : mixed
- Throws an exception on -ERR responses returned by Redis.
- executePipeline() : array<string|int, mixed>
- Implements the logic to flush the queued commands and read the responses from the current connection.
- getConnection() : ConnectionInterface
- Returns the underlying connection to be used by the pipeline.
- recordCommand() : mixed
- Queues a command instance into the pipeline buffer.
- throwServerExceptions() : bool
- Returns if the pipeline should throw exceptions on server errors.
- setRunning() : mixed
- Marks the running status of the pipeline.
Properties
$client
private
mixed
$client
$pipeline
private
mixed
$pipeline
$responses
private
mixed
$responses
= array()
$running
private
mixed
$running
= false
Methods
__call()
Queues a command into the pipeline buffer.
public
__call(string $method, array<string|int, mixed> $arguments) : $this
Parameters
- $method : string
-
Command ID.
- $arguments : array<string|int, mixed>
-
Arguments for the command.
Return values
$this —__construct()
public
__construct(ClientInterface $client) : mixed
Parameters
- $client : ClientInterface
-
Client instance used by the context.
Return values
mixed —execute()
Handles the actual execution of the whole pipeline.
public
execute([mixed $callable = null ]) : array<string|int, mixed>
Parameters
- $callable : mixed = null
-
Optional callback for execution.
Tags
Return values
array<string|int, mixed> —executeCommand()
Queues a command instance into the pipeline buffer.
public
executeCommand(CommandInterface $command) : $this
Parameters
- $command : CommandInterface
-
Command instance to be queued in the buffer.
Return values
$this —flushPipeline()
Flushes the buffer holding all of the commands queued so far.
public
flushPipeline([bool $send = true ]) : $this
Parameters
- $send : bool = true
-
Specifies if the commands in the buffer should be sent to Redis.
Return values
$this —getClient()
Returns the underlying client instance used by the pipeline object.
public
getClient() : ClientInterface
Return values
ClientInterface —exception()
Throws an exception on -ERR responses returned by Redis.
protected
exception(ConnectionInterface $connection, ErrorInterface $response) : mixed
Parameters
- $connection : ConnectionInterface
-
Redis connection that returned the error.
- $response : ErrorInterface
-
Instance of the error response.
Tags
Return values
mixed —executePipeline()
Implements the logic to flush the queued commands and read the responses from the current connection.
protected
executePipeline(ConnectionInterface $connection, SplQueue $commands) : array<string|int, mixed>
Parameters
- $connection : ConnectionInterface
-
Current connection instance.
- $commands : SplQueue
-
Queued commands.
Return values
array<string|int, mixed> —getConnection()
Returns the underlying connection to be used by the pipeline.
protected
getConnection() : ConnectionInterface
Return values
ConnectionInterface —recordCommand()
Queues a command instance into the pipeline buffer.
protected
recordCommand(CommandInterface $command) : mixed
Parameters
- $command : CommandInterface
-
Command to be queued in the buffer.
Return values
mixed —throwServerExceptions()
Returns if the pipeline should throw exceptions on server errors.
protected
throwServerExceptions() : bool
Return values
bool —setRunning()
Marks the running status of the pipeline.
private
setRunning(bool $bool) : mixed
Parameters
- $bool : bool
-
Sets the running status of the pipeline.