MultiExec
in package
implements
ClientContextInterface
Client-side abstraction of a Redis transaction based on MULTI / EXEC.
Tags
Interfaces, Classes and Traits
- ClientContextInterface
- Interface defining a client-side context such as a pipeline or transaction.
Table of Contents
- $attempts : mixed
- $client : mixed
- $commands : mixed
- $exceptions : mixed
- $modeCAS : mixed
- $watchKeys : mixed
- $state : mixed
- __call() : mixed
- Dynamically invokes a Redis command with the specified arguments.
- __construct() : mixed
- discard() : MultiExec
- Resets the transaction by UNWATCH-ing the keys that are being WATCHed and DISCARD-ing pending commands that have been already sent to the server.
- exec() : mixed
- Executes the whole transaction.
- execute() : array<string|int, mixed>
- Handles the actual execution of the whole transaction.
- executeCommand() : $this|mixed
- Executes the specified Redis command.
- multi() : MultiExec
- Finalizes the transaction by executing MULTI on the server.
- unwatch() : MultiExec
- Executes UNWATCH.
- watch() : mixed
- Executes WATCH against one or more keys.
- call() : mixed
- Executes a Redis command bypassing the transaction logic.
- configure() : mixed
- Configures the transaction using the provided options.
- executeTransactionBlock() : mixed
- Passes the current transaction object to a callable block for execution.
- initialize() : mixed
- Initializes the transaction context.
- reset() : mixed
- Resets the state of the transaction.
- assertClient() : mixed
- Checks if the passed client instance satisfies the required conditions needed to initialize the transaction object.
- checkBeforeExecution() : mixed
- Checks the state of the transaction before execution.
- onProtocolError() : mixed
- Helper method for protocol errors encountered inside the transaction.
Properties
$attempts
protected
mixed
$attempts
= 0
$client
protected
mixed
$client
$commands
protected
mixed
$commands
$exceptions
protected
mixed
$exceptions
= true
$modeCAS
protected
mixed
$modeCAS
= false
$watchKeys
protected
mixed
$watchKeys
= array()
$state
private
mixed
$state
Methods
__call()
Dynamically invokes a Redis command with the specified arguments.
public
__call(string $method, array<string|int, mixed> $arguments) : mixed
Parameters
- $method : string
-
Command ID.
- $arguments : array<string|int, mixed>
-
Arguments for the command.
Return values
mixed —__construct()
public
__construct(ClientInterface $client[, array<string|int, mixed> $options = null ]) : mixed
Parameters
- $client : ClientInterface
-
Client instance used by the transaction.
- $options : array<string|int, mixed> = null
-
Initialization options.
Return values
mixed —discard()
Resets the transaction by UNWATCH-ing the keys that are being WATCHed and DISCARD-ing pending commands that have been already sent to the server.
public
discard() : MultiExec
Return values
MultiExec —exec()
Executes the whole transaction.
public
exec() : mixed
Return values
mixed —execute()
Handles the actual execution of the whole transaction.
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()
Executes the specified Redis command.
public
executeCommand(CommandInterface $command) : $this|mixed
Parameters
- $command : CommandInterface
-
Command instance.
Tags
Return values
$this|mixed —multi()
Finalizes the transaction by executing MULTI on the server.
public
multi() : MultiExec
Return values
MultiExec —unwatch()
Executes UNWATCH.
public
unwatch() : MultiExec
Tags
Return values
MultiExec —watch()
Executes WATCH against one or more keys.
public
watch(string|array<string|int, mixed> $keys) : mixed
Parameters
- $keys : string|array<string|int, mixed>
-
One or more keys.
Tags
Return values
mixed —call()
Executes a Redis command bypassing the transaction logic.
protected
call(string $commandID[, array<string|int, mixed> $arguments = array() ]) : mixed
Parameters
- $commandID : string
-
Command ID.
- $arguments : array<string|int, mixed> = array()
-
Arguments for the command.
Tags
Return values
mixed —configure()
Configures the transaction using the provided options.
protected
configure(ClientInterface $client, array<string|int, mixed> $options) : mixed
Parameters
- $client : ClientInterface
-
Underlying client instance.
- $options : array<string|int, mixed>
-
Array of options for the transaction.
Return values
mixed —executeTransactionBlock()
Passes the current transaction object to a callable block for execution.
protected
executeTransactionBlock(mixed $callable) : mixed
Parameters
- $callable : mixed
-
Callback.
Tags
Return values
mixed —initialize()
Initializes the transaction context.
protected
initialize() : mixed
Return values
mixed —reset()
Resets the state of the transaction.
protected
reset() : mixed
Return values
mixed —assertClient()
Checks if the passed client instance satisfies the required conditions needed to initialize the transaction object.
private
assertClient(ClientInterface $client) : mixed
Parameters
- $client : ClientInterface
-
Client instance used by the transaction object.
Tags
Return values
mixed —checkBeforeExecution()
Checks the state of the transaction before execution.
private
checkBeforeExecution(mixed $callable) : mixed
Parameters
- $callable : mixed
-
Callback for execution.
Tags
Return values
mixed —onProtocolError()
Helper method for protocol errors encountered inside the transaction.
private
onProtocolError(string $message) : mixed
Parameters
- $message : string
-
Error message.