\PG\MSF\ProxyRedisProxyCluster

Class RedisProxyCluster

Summary

Methods
Properties
Constants
__construct()
startCheck()
handle()
evalMock()
check()
No public properties found
No constants found
dispatch()
No protected properties found
N/A
syncCheck()
generateUniqueKey()
random()
single()
multi()
$name
$pools
$goodPools
$keyPrefix
$hashKey
$isRandom
N/A

Properties

$name

$name : string

Type

string — 代理标识,它代表一个Redis集群

$pools

$pools : array

Type

array — 连接池列表 key=连接池名称, value=权重

$goodPools

$goodPools : array

Type

array — 通过探活检测的连接池列表

$keyPrefix

$keyPrefix : mixed|string

Type

mixed|string — key前缀

$hashKey

$hashKey : boolean|mixed

Type

boolean|mixed — 是否将key散列后储存

$isRandom

$isRandom : boolean

Type

boolean — 随机选择一个redis,一般用于redis前面有twemproxy等代理,每个代理都可以处理请求,随机即可

Methods

__construct()

__construct(string  $name, array  $config) 

RedisProxyCluster constructor.

Parameters

string $name

代理标识

array $config

代理配置数组

startCheck()

startCheck() : $this

检测可用的连接池

Returns

$this

handle()

handle(string  $method, array  $arguments) : array|boolean|mixed

发送异步Redis请求

Parameters

string $method

Redis指令

array $arguments

Redis指令参数

Returns

array|boolean|mixed

evalMock()

evalMock(array  $arguments) : array

执行Redis evalMock指令

Parameters

array $arguments

evalMock指令参数

Returns

array

check()

check() : boolean

用户定时检测

Returns

boolean

dispatch()

dispatch(array  $opArr, string  $method, array  $arguments) : array

请求分发

Parameters

array $opArr

相应Redis连接池的所有请求

string $method

Redis指令

array $arguments

Redis指令参数

Returns

array

syncCheck()

syncCheck() : $this

启动时同步检测可用的连接池

Returns

$this

generateUniqueKey()

generateUniqueKey(string  $key) : string

生成唯一Redis Key

Parameters

string $key

Key

Returns

string

random()

random(string  $method, array  $arguments) : boolean

随机策略

Parameters

string $method

Redis指令

array $arguments

Redis指令参数

Returns

boolean

single()

single(string  $method, string  $key, array  $arguments) : mixed

单key指令

Parameters

string $method

Redis指令

string $key

Redis Key

array $arguments

Redis指令参数

Returns

mixed

multi()

multi(string  $method, array  $key, array  $arguments) : array|boolean

批量多key指令

Parameters

string $method

Redis指令

array $key

Redis Key列表

array $arguments

Redis指令参数

Returns

array|boolean