swoole-redis协程

在redis里面设置key
在浏览器访问
localhost:8001/?a=key
协程redis在request里面使用

$http = new swoole_http_server('0.0.0.0', 8001);
$http->on('request', function ($request, $response){
    $redis = new Swoole\Coroutine\Redis();
    $redis->connect('172.16.1.13', 6379);
    $value = $redis->get($request->get['a']);
    $response->header("Content-Type", "text/plain");
    $response->end($value);
});

$http->start();
```

本作品采用《CC 协议》,转载必须注明作者和本文链接
讨论数量: 0
(= ̄ω ̄=)··· 暂无内容!

讨论应以学习和精进为目的。请勿发布不友善或者负能量的内容,与人为善,比聪明更重要!