ReplicationInterface
extends
AggregateConnectionInterface
in
Defines a group of Redis nodes in a master / slave replication setup.
Tags
Table of Contents
- add() : mixed
- Adds a connection instance to the aggregate connection.
- connect() : mixed
- Opens the connection to Redis.
- disconnect() : mixed
- Closes the connection to Redis.
- executeCommand() : mixed
- Writes a request for the given command over the connection and reads back the response returned by Redis.
- getConnection() : NodeConnectionInterface
- Returns the connection instance in charge for the given command.
- getConnectionById() : NodeConnectionInterface|null
- Returns a connection instance from the aggregate connection by its alias.
- getCurrent() : NodeConnectionInterface
- Returns the connection instance currently in use by the aggregate connection.
- getMaster() : NodeConnectionInterface
- Returns the connection instance for the master Redis node.
- getSlaves() : NodeConnectionInterface
- Returns a list of connection instances to slave nodes.
- isConnected() : bool
- Checks if the connection to Redis is considered open.
- readResponse() : mixed
- Reads the response to the given command from the connection.
- remove() : bool
- Removes the specified connection instance from the aggregate connection.
- switchTo() : mixed
- Switches the internal connection instance in use.
- writeRequest() : mixed
- Writes the request for the given command over the connection.
Methods
add()
Adds a connection instance to the aggregate connection.
public
add(NodeConnectionInterface $connection) : mixed
Parameters
- $connection : NodeConnectionInterface
-
Connection instance.
Return values
mixed —connect()
Opens the connection to Redis.
public
connect() : mixed
Return values
mixed —disconnect()
Closes the connection to Redis.
public
disconnect() : mixed
Return values
mixed —executeCommand()
Writes a request for the given command over the connection and reads back the response returned by Redis.
public
executeCommand(CommandInterface $command) : mixed
Parameters
- $command : CommandInterface
-
Command instance.
Return values
mixed —getConnection()
Returns the connection instance in charge for the given command.
public
getConnection(CommandInterface $command) : NodeConnectionInterface
Parameters
- $command : CommandInterface
-
Command instance.
Return values
NodeConnectionInterface —getConnectionById()
Returns a connection instance from the aggregate connection by its alias.
public
getConnectionById(string $connectionID) : NodeConnectionInterface|null
Parameters
- $connectionID : string
-
Connection alias.
Return values
NodeConnectionInterface|null —getCurrent()
Returns the connection instance currently in use by the aggregate connection.
public
getCurrent() : NodeConnectionInterface
Return values
NodeConnectionInterface —getMaster()
Returns the connection instance for the master Redis node.
public
getMaster() : NodeConnectionInterface
Return values
NodeConnectionInterface —getSlaves()
Returns a list of connection instances to slave nodes.
public
getSlaves() : NodeConnectionInterface
Return values
NodeConnectionInterface —isConnected()
Checks if the connection to Redis is considered open.
public
isConnected() : bool
Return values
bool —readResponse()
Reads the response to the given command from the connection.
public
readResponse(CommandInterface $command) : mixed
Parameters
- $command : CommandInterface
-
Command instance.
Return values
mixed —remove()
Removes the specified connection instance from the aggregate connection.
public
remove(NodeConnectionInterface $connection) : bool
Parameters
- $connection : NodeConnectionInterface
-
Connection instance.
Return values
bool —Returns true if the connection was in the pool.
switchTo()
Switches the internal connection instance in use.
public
switchTo(string $connection) : mixed
Parameters
- $connection : string
-
Alias of a connection
Return values
mixed —writeRequest()
Writes the request for the given command over the connection.
public
writeRequest(CommandInterface $command) : mixed
Parameters
- $command : CommandInterface
-
Command instance.