PHP Class Predis\Transaction\MultiExec

Author: Daniele Alessandri ([email protected])
Inheritance: implements Predis\ClientContextInterface
Exibir arquivo Open project: nrk/predis Class Usage Examples

Protected Properties

Property Type Description
$attempts
$client
$commands
$exceptions
$modeCAS
$watchKeys

Public Methods

Method Description
__call ( string $method, array $arguments ) : mixed Dynamically invokes a Redis command with the specified arguments.
__construct ( Predis\ClientInterface $client, array $options = null )
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 ( mixed $callable = null ) : array Handles the actual execution of the whole transaction.
executeCommand ( Predis\Command\CommandInterface $command ) Executes the specified Redis command.
multi ( ) : MultiExec Finalizes the transaction by executing MULTI on the server.
unwatch ( ) : MultiExec Executes UNWATCH.
watch ( string | array $keys ) : mixed Executes WATCH against one or more keys.

Protected Methods

Method Description
call ( string $commandID, array $arguments = [] ) : mixed Executes a Redis command bypassing the transaction logic.
configure ( Predis\ClientInterface $client, array $options ) Configures the transaction using the provided options.
executeTransactionBlock ( mixed $callable ) Passes the current transaction object to a callable block for execution.
initialize ( ) Initializes the transaction context.
reset ( ) Resets the state of the transaction.

Private Methods

Method Description
assertClient ( Predis\ClientInterface $client ) Checks if the passed client instance satisfies the required conditions needed to initialize the transaction object.
checkBeforeExecution ( mixed $callable ) Checks the state of the transaction before execution.
onProtocolError ( string $message ) Helper method for protocol errors encountered inside the transaction.

Method Details

__call() public method

Dynamically invokes a Redis command with the specified arguments.
public __call ( string $method, array $arguments ) : mixed
$method string Command ID.
$arguments array Arguments for the command.
return mixed

__construct() public method

public __construct ( Predis\ClientInterface $client, array $options = null )
$client Predis\ClientInterface Client instance used by the transaction.
$options array Initialization options.

call() protected method

Executes a Redis command bypassing the transaction logic.
protected call ( string $commandID, array $arguments = [] ) : mixed
$commandID string Command ID.
$arguments array Arguments for the command.
return mixed

configure() protected method

Configures the transaction using the provided options.
protected configure ( Predis\ClientInterface $client, array $options )
$client Predis\ClientInterface Underlying client instance.
$options array Array of options for the transaction.

discard() public method

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 MultiExec

exec() public method

Executes the whole transaction.
public exec ( ) : mixed
return mixed

execute() public method

Handles the actual execution of the whole transaction.
public execute ( mixed $callable = null ) : array
$callable mixed Optional callback for execution.
return array

executeCommand() public method

Executes the specified Redis command.
public executeCommand ( Predis\Command\CommandInterface $command )
$command Predis\Command\CommandInterface Command instance.

executeTransactionBlock() protected method

Passes the current transaction object to a callable block for execution.
protected executeTransactionBlock ( mixed $callable )
$callable mixed Callback.

initialize() protected method

Initializes the transaction context.
protected initialize ( )

multi() public method

Finalizes the transaction by executing MULTI on the server.
public multi ( ) : MultiExec
return MultiExec

reset() protected method

Resets the state of the transaction.
protected reset ( )

unwatch() public method

Executes UNWATCH.
public unwatch ( ) : MultiExec
return MultiExec

watch() public method

Executes WATCH against one or more keys.
public watch ( string | array $keys ) : mixed
$keys string | array One or more keys.
return mixed

Property Details

$attempts protected_oe property

protected $attempts

$client protected_oe property

protected $client

$commands protected_oe property

protected $commands

$exceptions protected_oe property

protected $exceptions

$modeCAS protected_oe property

protected $modeCAS

$watchKeys protected_oe property

protected $watchKeys