PHP 클래스 Predis\Client

저자: Daniele Alessandri ([email protected])
상속: implements predis\ClientInterface
파일 보기 프로젝트 열기: nrk/predis 1 사용 예제들

공개 메소드들

메소드 설명
__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