$keyPrefix
$keyPrefix : string
Class CoroutineRedisProxy
$redisAsynPool : \PG\MSF\Pools\RedisAsynPool
__construct(\PG\MSF\Pools\RedisAsynPool $redisAsynPool)
CoroutineRedisProxy constructor.
\PG\MSF\Pools\RedisAsynPool | $redisAsynPool | Redis连接池对象 |
cache(\PG\MSF\Helpers\Context $context, string $key, string $value = '', integer $expire) : mixed|\PG\MSF\Coroutine\Redis
redis cache 操作封装
\PG\MSF\Helpers\Context | $context | 请求上下文对象 |
string | $key | Redis Key |
string | $value | Redis Value |
integer | $expire | 过期时间,单位秒 |
evalMock(\PG\MSF\Helpers\Context $context, string $script, array $args = array(), integer $numKeys) : array
在redis执行lua脚本,因为redis原生方法eval是php的保留关键字,所以用该方法名代替 会根据$args参数中的缓存key进行redis实例选择
\PG\MSF\Helpers\Context | $context | 上下文 |
string | $script | Lua脚本代码 |
array | $args | 参数 |
integer | $numKeys | 脚本用到的redis的key的数量 |
redis中执行的Lua脚本,不支持直接返回多维数组,需要将多维数组转成json返回 本方法的返回值会对Lua脚本的返回值进行封装:
** File not found : { **
** File not found : [ **
** File not found : true **
** File not found : array(value1, **