PHP Класс Credis_Cluster

Устаревший:
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$aliases array Aliases of Credis_Client objects attached to Redis servers, used to route commands to specific servers
$clients Credis_Client[] Collection of Credis_Client objects attached to Redis servers
$dont_hash array The commands that are not subject to hashing
$masterClient Credis_Client If a server is set as master, all write commands go to that one
$nodes array Individual nodes of pointers to Redis servers on the hash ring
$ring array Hash ring of Redis server nodes
$selectedDb integer Currently working cluster-wide database number.

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

Метод Описание
__call ( string $name, array $args ) : mixed Execute a Redis command on the cluster with automatic consistent hashing and read/write splitting
__construct ( array $servers, integer $replicas = 128, boolean $standAlone = false ) Creates an interface to a cluster of Redis servers Each server should be in the format: array( 'host' => hostname, 'port' => port, 'db' => db, 'password' => password, 'timeout' => timeout, 'alias' => alias, 'persistent' => persistence_identifier, 'master' => master 'write_only'=> true/false )
all ( ) : array Execute a command on all clients
byHash ( string $key ) : Credis_Client Get the client that the key would hash to.
client ( string | integer $alias ) : Credis_Client Get a client by index or alias.
clients ( ) : array | Credis_Client[] Get an array of all clients
hash ( string $key ) : integer Get client index for a key by searching ring with binary search
isReadOnlyCommand ( $command )
select ( integer $index ) : void
setMasterClient ( Credis_Client $masterClient, boolean $writeOnly = false ) : Credis_Cluster

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

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

Execute a Redis command on the cluster with automatic consistent hashing and read/write splitting
public __call ( string $name, array $args ) : mixed
$name string
$args array
Результат mixed

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

Creates an interface to a cluster of Redis servers Each server should be in the format: array( 'host' => hostname, 'port' => port, 'db' => db, 'password' => password, 'timeout' => timeout, 'alias' => alias, 'persistent' => persistence_identifier, 'master' => master 'write_only'=> true/false )
public __construct ( array $servers, integer $replicas = 128, boolean $standAlone = false )
$servers array The Redis servers in the cluster.
$replicas integer
$standAlone boolean

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

Execute a command on all clients
public all ( ) : array
Результат array

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

Get the client that the key would hash to.
public byHash ( string $key ) : Credis_Client
$key string
Результат Credis_Client

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

Get a client by index or alias.
public client ( string | integer $alias ) : Credis_Client
$alias string | integer
Результат Credis_Client

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

Get an array of all clients
public clients ( ) : array | Credis_Client[]
Результат array | Credis_Client[]

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

Get client index for a key by searching ring with binary search
public hash ( string $key ) : integer
$key string The key to hash
Результат integer The index of the client object associated with the hash of the key

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

public isReadOnlyCommand ( $command )

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

public select ( integer $index ) : void
$index integer
Результат void

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

public setMasterClient ( Credis_Client $masterClient, boolean $writeOnly = false ) : Credis_Cluster
$masterClient Credis_Client
$writeOnly boolean
Результат Credis_Cluster

Описание свойств

$aliases защищенное свойство

Aliases of Credis_Client objects attached to Redis servers, used to route commands to specific servers
См. также: Credis_Cluster::to
protected array $aliases
Результат array

$clients защищенное свойство

Collection of Credis_Client objects attached to Redis servers
protected Credis_Client[] $clients
Результат Credis_Client[]

$dont_hash защищенное свойство

The commands that are not subject to hashing
protected array $dont_hash
Результат array

$masterClient защищенное свойство

If a server is set as master, all write commands go to that one
protected Credis_Client $masterClient
Результат Credis_Client

$nodes защищенное свойство

Individual nodes of pointers to Redis servers on the hash ring
protected array $nodes
Результат array

$ring защищенное свойство

Hash ring of Redis server nodes
protected array $ring
Результат array

$selectedDb защищенное свойство

Currently working cluster-wide database number.
protected int $selectedDb
Результат integer