PHP Класс Predis\Client

Автор: Daniele Alessandri ([email protected])
Наследование: implements predis\ClientInterface
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
__call ( $commandID, $arguments )
__construct ( mixed $parameters = null, mixed $options = null )
connect ( ) Opens the underlying connection and connects to the server.
createCommand ( $commandID, $arguments = [] )
disconnect ( ) Closes the underlying connection and disconnects from the server.
executeCommand ( Predis\Command\CommandInterface $command )
executeRaw ( array $arguments, boolean &$error = null ) : mixed Executes a command without filtering its arguments, parsing the response, applying any prefix to keys or throwing exceptions on Redis errors even regardless of client options.
getClientBy ( string $selector, string $value, callable | null $callable = null ) : predis\ClientInterface | mixed Creates a new client from the specified .
getCommandFactory ( )
getConnection ( )
getIterator ( )
getOptions ( )
isConnected ( ) : boolean Returns the current state of the underlying connection.
monitor ( ) : Consumer Creates a new monitor consumer and returns it.
pipeline ( ) : Pipeline | array Creates a new pipeline context and returns it, or returns the results of a pipeline executed inside the optionally provided callable object.
pubSubLoop ( ) : Consumer | null Creates a new publish/subscribe context and returns it, or starts its loop inside the optionally provided callable object.
quit ( ) Closes the underlying connection and disconnects from the server.
transaction ( ) : MultiExec | array Creates a new transaction context and returns it, or returns the results of a transaction executed inside the optionally provided callable object.

Защищенные методы

Метод Описание
createAggregateConnection ( mixed $parameters, string $option ) : Closure Creates an aggregate connection.
createConnection ( mixed $parameters ) : Predis\Connection\ConnectionInterface Creates single or aggregate connections from different types of arguments (string, array) or returns the passed argument if it is an instance of a class implementing Predis\Connection\ConnectionInterface.
createOptions ( mixed $options ) : Predis\Configuration\OptionsInterface Creates a new instance of Predis\Configuration\Options from different types of arguments or simply returns the passed argument if it is an instance of Predis\Configuration\OptionsInterface.
createPipeline ( array $options = null, mixed $callable = null ) : Pipeline | array Actual pipeline context initializer method.
createPubSub ( array $options = null, mixed $callable = null ) : Consumer | null Actual publish/subscribe context initializer method.
createTransaction ( array $options = null, mixed $callable = null ) : MultiExec | array Actual transaction context initializer method.
onErrorResponse ( Predis\Command\CommandInterface $command, Predis\Response\ErrorInterface $response ) : mixed Handles -ERR responses returned by Redis.

Приватные методы

Метод Описание
sharedContextFactory ( string $initializer, array $argv = null ) : mixed Executes the specified initializer method on $this by adjusting the actual invokation depending on the arity (0, 1 or 2 arguments). This is simply an utility method to create Redis contexts instances since they follow a common initialization path.

Описание методов

__call() публичный Метод

public __call ( $commandID, $arguments )

__construct() публичный Метод

public __construct ( mixed $parameters = null, mixed $options = null )
$parameters mixed Connection parameters for one or more servers.
$options mixed Options to configure some behaviours of the client.

connect() публичный Метод

Opens the underlying connection and connects to the server.
public connect ( )

createAggregateConnection() защищенный Метод

Creates an aggregate connection.
protected createAggregateConnection ( mixed $parameters, string $option ) : Closure
$parameters mixed Connection parameters.
$option string Option for aggregate connections (`aggregate`, `cluster`, `replication`).
Результат Closure

createCommand() публичный Метод

public createCommand ( $commandID, $arguments = [] )

createConnection() защищенный Метод

Accepted types for connection parameters are: - Instance of Predis\Connection\ConnectionInterface. - Instance of Predis\Connection\ParametersInterface. - Array - String - Callable
protected createConnection ( mixed $parameters ) : Predis\Connection\ConnectionInterface
$parameters mixed Connection parameters or connection instance.
Результат Predis\Connection\ConnectionInterface

createOptions() защищенный Метод

Creates a new instance of Predis\Configuration\Options from different types of arguments or simply returns the passed argument if it is an instance of Predis\Configuration\OptionsInterface.
protected createOptions ( mixed $options ) : Predis\Configuration\OptionsInterface
$options mixed Client options.
Результат Predis\Configuration\OptionsInterface

createPipeline() защищенный Метод

Actual pipeline context initializer method.
protected createPipeline ( array $options = null, mixed $callable = null ) : Pipeline | array
$options array Options for the context.
$callable mixed Optional callable used to execute the context.
Результат Predis\Pipeline\Pipeline | array

createPubSub() защищенный Метод

Actual publish/subscribe context initializer method.
protected createPubSub ( array $options = null, mixed $callable = null ) : Consumer | null
$options array Options for the context.
$callable mixed Optional callable used to execute the context.
Результат Predis\PubSub\Consumer | null

createTransaction() защищенный Метод

Actual transaction context initializer method.
protected createTransaction ( array $options = null, mixed $callable = null ) : MultiExec | array
$options array Options for the context.
$callable mixed Optional callable used to execute the context.
Результат Predis\Transaction\MultiExec | array

disconnect() публичный Метод

Closes the underlying connection and disconnects from the server.
public disconnect ( )

executeCommand() публичный Метод

public executeCommand ( Predis\Command\CommandInterface $command )
$command Predis\Command\CommandInterface

executeRaw() публичный Метод

It is possible to identify Redis error responses from normal responses using the second optional argument which is populated by reference.
public executeRaw ( array $arguments, boolean &$error = null ) : mixed
$arguments array Command arguments as defined by the command signature.
$error boolean Set to TRUE when Redis returned an error response.
Результат mixed

getClientBy() публичный Метод

The new client instances inherites the same options of the original one. When no callable object is supplied, this method returns the new client. When a callable object is supplied, the new client is passed as its sole argument and its return value is returned by this method to the caller. NOTE: This method works against any kind of underlying connection object as it uses a duck-typing approach and looks for a suitable method that matches the selector type to extract the correct connection.
public getClientBy ( string $selector, string $value, callable | null $callable = null ) : predis\ClientInterface | mixed
$selector string Type of selector (`id`, `key`, `slot`, `command`)
$value string Values of selector.
$callable callable | null Optional callable object.
Результат predis\ClientInterface | mixed

getCommandFactory() публичный Метод

public getCommandFactory ( )

getConnection() публичный Метод

public getConnection ( )

getIterator() публичный Метод

public getIterator ( )

getOptions() публичный Метод

public getOptions ( )

isConnected() публичный Метод

Returns the current state of the underlying connection.
public isConnected ( ) : boolean
Результат boolean

monitor() публичный Метод

Creates a new monitor consumer and returns it.
public monitor ( ) : Consumer
Результат Predis\Monitor\Consumer

onErrorResponse() защищенный Метод

Handles -ERR responses returned by Redis.
protected onErrorResponse ( Predis\Command\CommandInterface $command, Predis\Response\ErrorInterface $response ) : mixed
$command Predis\Command\CommandInterface Redis command that generated the error.
$response Predis\Response\ErrorInterface Instance of the error response.
Результат mixed

pipeline() публичный Метод

Creates a new pipeline context and returns it, or returns the results of a pipeline executed inside the optionally provided callable object.
public pipeline ( ) : Pipeline | array
Результат Predis\Pipeline\Pipeline | array

pubSubLoop() публичный Метод

Creates a new publish/subscribe context and returns it, or starts its loop inside the optionally provided callable object.
public pubSubLoop ( ) : Consumer | null
Результат Predis\PubSub\Consumer | null

quit() публичный Метод

This is the same as Client::disconnect() as it does not actually send the QUIT command to Redis, but simply closes the connection.
public quit ( )

transaction() публичный Метод

Creates a new transaction context and returns it, or returns the results of a transaction executed inside the optionally provided callable object.
public transaction ( ) : MultiExec | array
Результат Predis\Transaction\MultiExec | array