Свойство | Тип | Описание | |
---|---|---|---|
$connectionTimeout | timeout to use for connection to redis. If not set the timeout set in php.ini will be used: ini_get("default_socket_timeout") | ||
$dataTimeout | timeout to use for redis socket when reading and writing data. If not set the php default value will be used. | ||
$database | the redis database to use. This is an integer value starting from 0. Defaults to 0. Since version 2.0.6 you can disable the SELECT command sent after connection by setting this property to null. | ||
$hostname | the hostname or ip address to use for connecting to the redis server. Defaults to 'localhost'. If [[unixSocket]] is specified, hostname and port will be ignored. | ||
$password | the password for establishing DB connection. Defaults to null meaning no AUTH command is send. See http://redis.io/commands/auth | ||
$port | the port to use for connecting to the redis server. Default port is 6379. If [[unixSocket]] is specified, hostname and port will be ignored. | ||
$redisCommands | List of available redis commands http://redis.io/commands | ||
$socketClientFlags | Bitmask field which may be set to any combination of connection flags passed to stream_socket_client(). Currently the select of connection flags is limited to STREAM_CLIENT_CONNECT (default), STREAM_CLIENT_ASYNC_CONNECT and STREAM_CLIENT_PERSISTENT. | ||
$unixSocket | the unix socket path (e.g. /var/run/redis/redis.sock) to use for connecting to the redis server. This can be used instead of [[hostname]] and [[port]] to connect to the server using a unix socket. If a unix socket path is specified, [[hostname]] and [[port]] will be ignored. |
Метод | Описание | |
---|---|---|
__call ( string $name, array $params ) : mixed | Allows issuing all supported commands via magic methods. | |
__sleep ( ) : array | Closes the connection when this component is being serialized. | |
close ( ) | Closes the currently active DB connection. | |
executeCommand ( string $name, array $params = [] ) : array | boolean | null | string | Executes a redis command. | |
getDriverName ( ) : string | Returns the name of the DB driver for the current [[dsn]]. | |
getIsActive ( ) : boolean | Returns a value indicating whether the DB connection is established. | |
getLuaScriptBuilder ( ) : yii\redis\LuaScriptBuilder | ||
open ( ) | Establishes a DB connection. |
Метод | Описание | |
---|---|---|
initConnection ( ) | Initializes the DB connection. |
Метод | Описание | |
---|---|---|
parseResponse ( string $command ) : mixed |
public executeCommand ( string $name, array $params = [] ) : array | boolean | null | string | ||
$name | string | the name of the command |
$params | array | list of parameters for the command |
Результат | array | boolean | null | string | Dependent on the executed command this method will return different data types: - `true` for commands that return "status reply" with the message `'OK'` or `'PONG'`. - `string` for commands that return "status reply" that does not have the message `OK` (since version 2.0.1). - `string` for commands that return "integer reply" as the value is in the range of a signed 64 bit integer. - `string` or `null` for commands that return "bulk reply". - `array` for commands that return "Multi-bulk replies". See [redis protocol description](http://redis.io/topics/protocol) for details on the mentioned reply types. |
public getDriverName ( ) : string | ||
Результат | string | name of the DB driver |
public getIsActive ( ) : boolean | ||
Результат | boolean | whether the DB connection is established |
public getLuaScriptBuilder ( ) : yii\redis\LuaScriptBuilder | ||
Результат | yii\redis\LuaScriptBuilder |
protected initConnection ( ) |
public open ( ) |
public $connectionTimeout |
public $dataTimeout |
public $database |
public $hostname |
public $password |
public $port |
public $redisCommands |
public $socketClientFlags |
public $unixSocket |