PredisCluster
in package
implements
ClusterInterface, IteratorAggregate, Countable
Abstraction for a cluster of aggregate connections to various Redis servers implementing client-side sharding based on pluggable distribution strategies.
Tags
Interfaces, Classes and Traits
- ClusterInterface
- Defines a cluster of Redis servers formed by aggregating multiple connection instances to single Redis nodes.
- IteratorAggregate
- Countable
Table of Contents
- $distributor : mixed
- $pool : mixed
- $strategy : mixed
- __construct() : mixed
- add() : mixed
- {@inheritdoc}
- connect() : mixed
- {@inheritdoc}
- count() : int
- disconnect() : mixed
- {@inheritdoc}
- executeCommand() : mixed
- {@inheritdoc}
- executeCommandOnNodes() : array<string|int, mixed>
- Executes the specified Redis command on all the nodes of a cluster.
- getClusterStrategy() : StrategyInterface
- Returns the underlying command hash strategy used to hash commands by using keys found in their arguments.
- getConnection() : mixed
- {@inheritdoc}
- getConnectionById() : mixed
- {@inheritdoc}
- getConnectionByKey() : NodeConnectionInterface
- Retrieves a connection instance from the cluster using a key.
- getIterator() : Traversable<string|int, NodeConnectionInterface>
- isConnected() : mixed
- {@inheritdoc}
- readResponse() : mixed
- {@inheritdoc}
- remove() : mixed
- {@inheritdoc}
- removeById() : bool
- Removes a connection instance using its alias or index.
- writeRequest() : mixed
- {@inheritdoc}
Properties
$distributor
private
mixed
$distributor
$pool
private
mixed
$pool
$strategy
private
mixed
$strategy
Methods
__construct()
public
__construct([StrategyInterface $strategy = null ]) : mixed
Parameters
- $strategy : StrategyInterface = null
-
Optional cluster strategy.
Return values
mixed —add()
{@inheritdoc}
public
add(NodeConnectionInterface $connection) : mixed
Parameters
- $connection : NodeConnectionInterface
Return values
mixed —connect()
{@inheritdoc}
public
connect() : mixed
Return values
mixed —count()
public
count() : int
Return values
int —disconnect()
{@inheritdoc}
public
disconnect() : mixed
Return values
mixed —executeCommand()
{@inheritdoc}
public
executeCommand(CommandInterface $command) : mixed
Parameters
- $command : CommandInterface
Return values
mixed —executeCommandOnNodes()
Executes the specified Redis command on all the nodes of a cluster.
public
executeCommandOnNodes(CommandInterface $command) : array<string|int, mixed>
Parameters
- $command : CommandInterface
-
A Redis command.
Return values
array<string|int, mixed> —getClusterStrategy()
Returns the underlying command hash strategy used to hash commands by using keys found in their arguments.
public
getClusterStrategy() : StrategyInterface
Return values
StrategyInterface —getConnection()
{@inheritdoc}
public
getConnection(CommandInterface $command) : mixed
Parameters
- $command : CommandInterface
Return values
mixed —getConnectionById()
{@inheritdoc}
public
getConnectionById(mixed $connectionID) : mixed
Parameters
- $connectionID : mixed
Return values
mixed —getConnectionByKey()
Retrieves a connection instance from the cluster using a key.
public
getConnectionByKey(string $key) : NodeConnectionInterface
Parameters
- $key : string
-
Key string.
Return values
NodeConnectionInterface —getIterator()
public
getIterator() : Traversable<string|int, NodeConnectionInterface>
Return values
Traversable<string|int, NodeConnectionInterface> —isConnected()
{@inheritdoc}
public
isConnected() : mixed
Return values
mixed —readResponse()
{@inheritdoc}
public
readResponse(CommandInterface $command) : mixed
Parameters
- $command : CommandInterface
Return values
mixed —remove()
{@inheritdoc}
public
remove(NodeConnectionInterface $connection) : mixed
Parameters
- $connection : NodeConnectionInterface
Return values
mixed —removeById()
Removes a connection instance using its alias or index.
public
removeById(string $connectionID) : bool
Parameters
- $connectionID : string
-
Alias or index of a connection.
Return values
bool —Returns true if the connection was in the pool.
writeRequest()
{@inheritdoc}
public
writeRequest(CommandInterface $command) : mixed
Parameters
- $command : CommandInterface