# \PG\MSF\CoroutineRedis

Class Redis

## Summary

Methods
Properties
Constants
__construct()
getResult()
throwTimeOutException()
isTimeout()
nextRun()
destroy()
__unsleep()
breakx()
setTimeout()
send()
$maxTimeout
$request
$result
$timeout
$requestTime
$responseTime
$ioBack
$ioBackKey
$isBreak
$requestId
$name
$arguments
$keyPrefix
$hashKey
$phpSerialize
$redisSerialize
$redisAsynPool
No constants found
unSerializeHandler()
No protected properties found
N/A
canUnserialize()
realUnserialize()
No private properties found
N/A

File
  Coroutine/Redis.php
Package
  MSF\Coroutine
Class hierarchy
  \PG\MSF\Coroutine\Base
  \PG\MSF\Coroutine\Redis

## Tags

None found

## Properties

### $maxTimeout

    $maxTimeout : integer

#### Type

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

#

Inherited from
  \PG\MSF\Coroutine\Base

## Tags

None found

### $request

    $request : string

#### Type

string — 请求参数

#

Inherited from
  \PG\MSF\Coroutine\Base

## Tags

None found

### $result

    $result : mixed

#### Type

mixed — IO协程运行的结束

#

Inherited from
  \PG\MSF\Coroutine\Base

## Tags

None found

### $timeout

    $timeout : integer

#### Type

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

#

Inherited from
  \PG\MSF\Coroutine\Base

## Tags

None found

### $requestTime

    $requestTime : float

#### Type

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

#

Inherited from
  \PG\MSF\Coroutine\Base

## Tags

None found

### $responseTime

    $responseTime : float

#### Type

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

#

Inherited from
  \PG\MSF\Coroutine\Base

## Tags

None found

### $ioBack

    $ioBack : boolean

#### Type

boolean — IO协程是否返回数据

#

Inherited from
  \PG\MSF\Coroutine\Base

## Tags

None found

### $ioBackKey

    $ioBackKey : integer|null

#### Type

integer|null — ioBack标识

#

Inherited from
  \PG\MSF\Coroutine\Base

## Tags

None found

### $isBreak

    $isBreak : boolean

#### Type

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

#

Inherited from
  \PG\MSF\Coroutine\Base

## Tags

None found

### $requestId

    $requestId : string|null

#### Type

string|null — 整个请求标识

#

Inherited from
  \PG\MSF\Coroutine\Base

## Tags

None found

### $name

    $name : string

#### Type

string — Redis操作指令

#

## Tags

None found

### $arguments

    $arguments : array

#### Type

array — Redis操作指令的参数

#

## Tags

None found

### $keyPrefix

    $keyPrefix : string

#### Type

string — Key前缀

#

## Tags

None found

### $hashKey

    $hashKey : boolean

#### Type

boolean — 是否自动Hash Key

#

## Tags

None found

### $phpSerialize

    $phpSerialize : boolean

#### Type

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

#

## Tags

None found

### $redisSerialize

    $redisSerialize : boolean

#### Type

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

#

## Tags

None found

### $redisAsynPool

    $redisAsynPool : \PG\MSF\Pools\RedisAsynPool

#### Type

\PG\MSF\Pools\RedisAsynPool — Redis异步连接池

#

## Tags

None found

## 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指令参数

#

## Tags

None found

### getResult()

    getResult() : mixed|null

获取协程执行结果

#### Returns

mixed|null

#

Inherited from
  \PG\MSF\Coroutine\Base

## Tags

None found

### throwTimeOutException()

    throwTimeOutException()

协程超时异常

#### Throws

\Exception

#

Inherited from
  \PG\MSF\Coroutine\Base

## Tags

None found

### isTimeout()

    isTimeout() : boolean

判断协程是否超时

#### Returns

boolean

#

Inherited from
  \PG\MSF\Coroutine\Base

## Tags

None found

### nextRun()

    nextRun() : boolean

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

#### Returns

boolean

#

Inherited from
  \PG\MSF\Coroutine\Base

## Tags

None found

### destroy()

    destroy()

销毁

#

## Tags

None found

### __unsleep()

    __unsleep() : array

属性不用于序列化

#### Returns

array

#

## Tags

None found

### breakx()

    breakx() : boolean

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

#### Returns

boolean

#

Inherited from
  \PG\MSF\Coroutine\Base

## Tags

None found

### setTimeout()

    setTimeout(integer  $timeout) : $this

手工设置超时时间

#### Parameters

integer | $timeout | 超时时间，单位毫秒

#### Returns

$this

#

Inherited from
  \PG\MSF\Coroutine\Base

## Tags

None found

### send()

    send(callable  $callback)

发送异步的Redis请求

#### Parameters

callable | $callback | Redis指令执行后的回调函数

#

## Tags

None found

### 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

#

## Tags

None found

### canUnserialize()

    canUnserialize(string  $string) : boolean

是否可以反序列化

#### Parameters

string | $string | 待反序列化的原始数据

#### Returns

boolean

#

## Tags

None found

### realUnserialize()

    realUnserialize(string  $data) : mixed|string

真正反序列化

#### Parameters

string | $data | 待反序列化的原始数据

#### Returns

mixed|string

#

## Tags

None found

### Redis.php