RawCommand
in package
implements
CommandInterface
Class for generic "anonymous" Redis commands.
This command class does not filter input arguments or parse responses, but can be used to leverage the standard Predis API to execute any command simply by providing the needed arguments following the command signature as defined by Redis in its documentation.
Tags
Interfaces, Classes and Traits
- CommandInterface
- Defines an abstraction representing a Redis command.
Table of Contents
- $arguments : mixed
- $commandID : mixed
- $slot : mixed
- __construct() : mixed
- create() : CommandInterface
- Creates a new raw command using a variadic method.
- getArgument() : mixed|null
- Gets the argument of the command at the specified index.
- getArguments() : array<string|int, mixed>
- Gets the arguments of the command.
- getId() : string
- Returns the ID of the Redis command. By convention, command identifiers must always be uppercase.
- getSlot() : int|null
- Returns the assigned slot of the command for clustering distribution.
- parseResponse() : mixed
- Parses a raw response and returns a PHP object.
- setArguments() : mixed
- Sets the arguments for the command.
- setRawArguments() : mixed
- Sets the raw arguments for the command without processing them.
- setSlot() : mixed
- Assign the specified slot to the command for clustering distribution.
Properties
$arguments
private
mixed
$arguments
$commandID
private
mixed
$commandID
$slot
private
mixed
$slot
Methods
__construct()
public
__construct(array<string|int, mixed> $arguments) : mixed
Parameters
- $arguments : array<string|int, mixed>
-
Command ID and its arguments.
Tags
Return values
mixed —create()
Creates a new raw command using a variadic method.
public
static create(string $commandID) : CommandInterface
Parameters
- $commandID : string
-
Redis command ID.
Return values
CommandInterface —getArgument()
Gets the argument of the command at the specified index.
public
getArgument(mixed $index) : mixed|null
Parameters
- $index : mixed
-
Index of the desired argument.
Return values
mixed|null —getArguments()
Gets the arguments of the command.
public
getArguments() : array<string|int, mixed>
Return values
array<string|int, mixed> —getId()
Returns the ID of the Redis command. By convention, command identifiers must always be uppercase.
public
getId() : string
Return values
string —getSlot()
Returns the assigned slot of the command for clustering distribution.
public
getSlot() : int|null
Return values
int|null —parseResponse()
Parses a raw response and returns a PHP object.
public
parseResponse(mixed $data) : mixed
Parameters
- $data : mixed
-
Binary string containing the whole response.
Return values
mixed —setArguments()
Sets the arguments for the command.
public
setArguments(array<string|int, mixed> $arguments) : mixed
Parameters
- $arguments : array<string|int, mixed>
-
List of arguments.
Return values
mixed —setRawArguments()
Sets the raw arguments for the command without processing them.
public
setRawArguments(array<string|int, mixed> $arguments) : mixed
Parameters
- $arguments : array<string|int, mixed>
-
List of arguments.
Return values
mixed —setSlot()
Assign the specified slot to the command for clustering distribution.
public
setSlot(mixed $slot) : mixed
Parameters
- $slot : mixed
-
Slot ID.