메소드 | 설명 | |
---|---|---|
__construct ( Predis\Connection\FactoryInterface $connections, Predis\Cluster\StrategyInterface $strategy = null ) | ||
add ( Predis\Connection\NodeConnectionInterface $connection ) | ||
askSlotMap ( Predis\Connection\NodeConnectionInterface $connection = null ) | Generates an updated slots map fetching the cluster configuration using the CLUSTER SLOTS command against the specified node or a random one from the pool. | |
buildSlotMap ( ) | Generates the current slots map by guessing the cluster configuration out of the connection parameters of the connections in the pool. | |
connect ( ) | ||
count ( ) | ||
disconnect ( ) | ||
executeCommand ( Predis\Command\CommandInterface $command ) | ||
getClusterStrategy ( ) : Predis\Cluster\StrategyInterface | Returns the underlying command hash strategy used to hash commands by using keys found in their arguments. | |
getConnectionByCommand ( Predis\Command\CommandInterface $command ) | ||
getConnectionById ( $connectionID ) | ||
getConnectionBySlot ( integer $slot ) : Predis\Connection\NodeConnectionInterface | Returns the connection currently associated to a given slot. | |
getConnectionFactory ( ) : Predis\Connection\FactoryInterface | Returns the underlying connection factory used to create new connection instances to Redis nodes indicated by redis-cluster. | |
getIterator ( ) | ||
getSlotMap ( ) : |
Returns the underlying slot map. | |
isConnected ( ) | ||
readResponse ( Predis\Command\CommandInterface $command ) | ||
remove ( Predis\Connection\NodeConnectionInterface $connection ) | ||
removeById ( string $connectionID ) : boolean | Removes a connection instance by using its identifier. | |
setRetryLimit ( integer $retry ) | Sets the maximum number of retries for commands upon server failure. | |
useClusterSlots ( boolean $value ) | Enables automatic fetching of the current slots map from one of the nodes using the CLUSTER SLOTS command. This option is enabled by default as asking the current slots map to Redis upon -MOVED responses may reduce overhead by eliminating the trial-and-error nature of the node guessing procedure, mostly when targeting many keys that would end up in a lot of redirections. | |
writeRequest ( Predis\Command\CommandInterface $command ) |
메소드 | 설명 | |
---|---|---|
createConnection ( string $connectionID ) : Predis\Connection\NodeConnectionInterface | Creates a new connection instance from the given connection ID. | |
getRandomConnection ( ) : Predis\Connection\NodeConnectionInterface | null | Returns a random connection from the pool. | |
guessNode ( integer $slot ) : string | Guesses the correct node associated to a given slot using a precalculated slots map, falling back to the same logic used by Redis to initialize a cluster (best-effort). | |
move ( Predis\Connection\NodeConnectionInterface $connection, integer $slot ) | Permanently associates the connection instance to a new slot. | |
onAskResponse ( Predis\Command\CommandInterface $command, string $details ) : mixed | Handles -ASK responses by executing again the command against the node indicated by the Redis response. | |
onErrorResponse ( Predis\Command\CommandInterface $command, Predis\Response\ErrorInterface $error ) : mixed | Handles -ERR responses returned by Redis. | |
onMovedResponse ( Predis\Command\CommandInterface $command, string $details ) : mixed | Handles -MOVED responses by executing again the command against the node indicated by the Redis response. |
메소드 | 설명 | |
---|---|---|
queryClusterNodeForSlotMap ( Predis\Connection\NodeConnectionInterface $connection ) : mixed | Queries the specified node of the cluster to fetch the updated slots map. | |
retryCommandOnFailure ( Predis\Command\CommandInterface $command, string $method ) : mixed | Ensures that a command is executed one more time on connection failure. |
public __construct ( Predis\Connection\FactoryInterface $connections, Predis\Cluster\StrategyInterface $strategy = null ) | ||
$connections | Predis\Connection\FactoryInterface | Optional connection factory. |
$strategy | Predis\Cluster\StrategyInterface | Optional cluster strategy. |
public add ( Predis\Connection\NodeConnectionInterface $connection ) | ||
$connection | Predis\Connection\NodeConnectionInterface |
public askSlotMap ( Predis\Connection\NodeConnectionInterface $connection = null ) | ||
$connection | Predis\Connection\NodeConnectionInterface | Optional connection instance. |
public buildSlotMap ( ) |
protected createConnection ( string $connectionID ) : Predis\Connection\NodeConnectionInterface | ||
$connectionID | string | Identifier for the connection. |
리턴 | Predis\Connection\NodeConnectionInterface |
public executeCommand ( Predis\Command\CommandInterface $command ) | ||
$command | Predis\Command\CommandInterface |
public getClusterStrategy ( ) : Predis\Cluster\StrategyInterface | ||
리턴 | Predis\Cluster\StrategyInterface |
public getConnectionByCommand ( Predis\Command\CommandInterface $command ) | ||
$command | Predis\Command\CommandInterface |
public getConnectionBySlot ( integer $slot ) : Predis\Connection\NodeConnectionInterface | ||
$slot | integer | Slot index. |
리턴 | Predis\Connection\NodeConnectionInterface |
public getConnectionFactory ( ) : Predis\Connection\FactoryInterface | ||
리턴 | Predis\Connection\FactoryInterface |
protected getRandomConnection ( ) : Predis\Connection\NodeConnectionInterface | null | ||
리턴 | Predis\Connection\NodeConnectionInterface | null |
public getSlotMap ( ) : |
||
리턴 |
protected onAskResponse ( Predis\Command\CommandInterface $command, string $details ) : mixed | ||
$command | Predis\Command\CommandInterface | Command that generated the -ASK response. |
$details | string | Parameters of the -ASK response. |
리턴 | mixed |
protected onErrorResponse ( Predis\Command\CommandInterface $command, Predis\Response\ErrorInterface $error ) : mixed | ||
$command | Predis\Command\CommandInterface | Command that generated the -ERR response. |
$error | Predis\Response\ErrorInterface | Redis error response object. |
리턴 | mixed |
protected onMovedResponse ( Predis\Command\CommandInterface $command, string $details ) : mixed | ||
$command | Predis\Command\CommandInterface | Command that generated the -MOVED response. |
$details | string | Parameters of the -MOVED response. |
리턴 | mixed |
public readResponse ( Predis\Command\CommandInterface $command ) | ||
$command | Predis\Command\CommandInterface |
public remove ( Predis\Connection\NodeConnectionInterface $connection ) | ||
$connection | Predis\Connection\NodeConnectionInterface |
public removeById ( string $connectionID ) : boolean | ||
$connectionID | string | Connection identifier. |
리턴 | boolean | True if the connection was in the pool. |
public setRetryLimit ( integer $retry ) | ||
$retry | integer | Number of retry attempts. |
public useClusterSlots ( boolean $value ) | ||
$value | boolean | Enable or disable the use of CLUSTER SLOTS. |
public writeRequest ( Predis\Command\CommandInterface $command ) | ||
$command | Predis\Command\CommandInterface |