Properties

$maxTimeout

$maxTimeout : integer

Type

integer — 协程运行的最大超时时间

$request

$request : string

Type

string — 请求参数

$result

$result : mixed

Type

mixed — IO协程运行的结束

$timeout

$timeout : integer

Type

integer — 协程执行的超时时间精确到ms

$requestTime

$requestTime : float

Type

float — 协程执行请求开始时间

$responseTime

$responseTime : float

Type

float — 协程执行请求结束时间

$ioBack

$ioBack : boolean

Type

boolean — IO协程是否返回数据

$ioBackKey

$ioBackKey : integer|null

Type

integer|null — ioBack标识

$isBreak

$isBreak : boolean

Type

boolean — 是否发送异步请求后不需要执行回调

$requestId

$requestId : string|null

Type

string|null — 整个请求标识

$name

$name : string

Type

string — Redis操作指令

$arguments

$arguments : array

Type

array — Redis操作指令的参数

$keyPrefix

$keyPrefix : string

Type

string — Key前缀

$hashKey

$hashKey : boolean

Type

boolean — 是否自动Hash Key

$phpSerialize

$phpSerialize : boolean

Type

boolean — 是否启用PHP的自动序列化

$redisSerialize

$redisSerialize : boolean

Type

boolean — 是否启用Redis的自动序列化

Methods

__construct()

__construct(\PG\MSF\Pools\RedisAsynPool  $redisAsynPool, string  $name, array  $arguments) 

初始化Redis异步请求的协程对象

Parameters

\PG\MSF\Pools\RedisAsynPool $redisAsynPool

Redis连接池实例

string $name

Redis指令

array $arguments

Redis指令参数

getResult()

getResult() : mixed|null

获取协程执行结果

Returns

mixed|null

throwTimeOutException()

throwTimeOutException() 

协程超时异常

Throws

\Exception

isTimeout()

isTimeout() : boolean

判断协程是否超时

Returns

boolean

nextRun()

nextRun() : boolean

通知调度器进行下一次迭代

Returns

boolean

destroy()

destroy() 

销毁

__unsleep()

__unsleep() : array

属性不用于序列化

Returns

array

breakx()

breakx() : boolean

发送异步请求后不需要执行回调

Returns

boolean

setTimeout()

setTimeout(integer  $timeout) : $this

手工设置超时时间

Parameters

integer $timeout

超时时间,单位毫秒

Returns

$this

send()

send(callable  $callback) 

发送异步的Redis请求

Parameters

callable $callback

Redis指令执行后的回调函数

unSerializeHandler()

unSerializeHandler(mixed  $data, array  $keys = array(), integer  $len) : array|boolean|mixed

反序列化

Parameters

mixed $data

Redis响应数据

array $keys

Redis操作的Key列表

integer $len

操作的数据量

Returns

array|boolean|mixed

canUnserialize()

canUnserialize(string  $string) : boolean

是否可以反序列化

Parameters

string $string

待反序列化的原始数据

Returns

boolean

realUnserialize()

realUnserialize(string  $data) : mixed|string

真正反序列化

Parameters

string $data

待反序列化的原始数据

Returns

mixed|string