PHP Class Predis\Replication\ReplicationStrategy

Author: Daniele Alessandri ([email protected])
Show file Open project: tillkruss/redis-object-cache Class Usage Examples

Protected Properties

Property Type Description
$disallowed
$readonly
$readonlySHA1

Public Methods

Method Description
__construct ( )
isDisallowedOperation ( Predis\Command\CommandInterface $command ) : boolean Returns if the specified command is not allowed for execution in a master slave replication context.
isReadOperation ( Predis\Command\CommandInterface $command ) : boolean Returns if the specified command will perform a read-only operation on Redis or not.
setCommandReadOnly ( string $commandID, mixed $readonly = true ) Marks a command as a read-only operation.
setScriptReadOnly ( string $script, mixed $readonly = true ) Marks a Lua script for EVAL and EVALSHA as a read-only operation. When the behaviour of a script can be decided only at runtime depending on its arguments, a callable object can be provided to dynamically check if the passed instance of EVAL or EVALSHA performs write operations or not.

Protected Methods

Method Description
getDisallowedOperations ( ) : array Returns the default list of disallowed commands.
getReadOnlyOperations ( ) : array Returns the default list of commands performing read-only operations.
isBitfieldReadOnly ( Predis\Command\CommandInterface $command ) : boolean Checks if BITFIELD performs a read-only operation by looking for certain SET and INCRYBY modifiers in the arguments array of the command.
isGeoradiusReadOnly ( Predis\Command\CommandInterface $command ) : boolean Checks if a GEORADIUS command is a readable operation by parsing the arguments array of the specified commad instance.
isSortReadOnly ( Predis\Command\CommandInterface $command ) : boolean Checks if a SORT command is a readable operation by parsing the arguments array of the specified commad instance.

Method Details

__construct() public method

public __construct ( )

getDisallowedOperations() protected method

Returns the default list of disallowed commands.
protected getDisallowedOperations ( ) : array
return array

getReadOnlyOperations() protected method

Returns the default list of commands performing read-only operations.
protected getReadOnlyOperations ( ) : array
return array

isBitfieldReadOnly() protected method

Checks if BITFIELD performs a read-only operation by looking for certain SET and INCRYBY modifiers in the arguments array of the command.
protected isBitfieldReadOnly ( Predis\Command\CommandInterface $command ) : boolean
$command Predis\Command\CommandInterface Command instance.
return boolean

isDisallowedOperation() public method

Returns if the specified command is not allowed for execution in a master slave replication context.
public isDisallowedOperation ( Predis\Command\CommandInterface $command ) : boolean
$command Predis\Command\CommandInterface Command instance.
return boolean

isGeoradiusReadOnly() protected method

Checks if a GEORADIUS command is a readable operation by parsing the arguments array of the specified commad instance.
protected isGeoradiusReadOnly ( Predis\Command\CommandInterface $command ) : boolean
$command Predis\Command\CommandInterface Command instance.
return boolean

isReadOperation() public method

Returns if the specified command will perform a read-only operation on Redis or not.
public isReadOperation ( Predis\Command\CommandInterface $command ) : boolean
$command Predis\Command\CommandInterface Command instance.
return boolean

isSortReadOnly() protected method

Checks if a SORT command is a readable operation by parsing the arguments array of the specified commad instance.
protected isSortReadOnly ( Predis\Command\CommandInterface $command ) : boolean
$command Predis\Command\CommandInterface Command instance.
return boolean

setCommandReadOnly() public method

When the behavior of a command can be decided only at runtime depending on its arguments, a callable object can be provided to dynamically check if the specified command performs a read or a write operation.
public setCommandReadOnly ( string $commandID, mixed $readonly = true )
$commandID string Command ID.
$readonly mixed A boolean value or a callable object.

setScriptReadOnly() public method

Marks a Lua script for EVAL and EVALSHA as a read-only operation. When the behaviour of a script can be decided only at runtime depending on its arguments, a callable object can be provided to dynamically check if the passed instance of EVAL or EVALSHA performs write operations or not.
public setScriptReadOnly ( string $script, mixed $readonly = true )
$script string Body of the Lua script.
$readonly mixed A boolean value or a callable object.

Property Details

$disallowed protected property

protected $disallowed

$readonly protected property

protected $readonly

$readonlySHA1 protected property

protected $readonlySHA1