getRedis

获取Redis的同步实例。

注意,在1.7版本后我们推荐统一使用协程的方式调用Redis,Mysql。使用协程的API调用可以自动分配异步客户端或者是同步客户端。

协程的例子:

    public function testRedisDecrBy()
    {
        yield $this->redis_pool->getCoroutine()->set('key1', 10);
        yield $this->redis_pool->getCoroutine()->decrBy('key1', 10);
        $value = yield $this->redis_pool->getCoroutine()->get('key1');
    }

results matching ""

    No results matching ""