swoole_redis 记一次看文档不仔细做警醒

测试代码

 1 $redisClass = new Redis();
 2 $redisClass->connect('127.0.0.1', 6379, 1);
 3 $result = $redisClass->hmset('mytest:phpredis1', ['aa' => 'aa', 'bb' => 'bb']); // 原生的支持数组
 4 var_dump($result);
 5 
 7 $redis = new swoole_redis();
 8 $redis->connect('127.0.0.1', 6379, 
 9     function (swoole_redis $client, $result) {
10         $client->hmset('mytest:swooleredis_hmset1', ['aa' => 'aa', 'bb' => 'bb'], function(swoole_redis $client, $result){
11             var_dump($result);
12         });
13 
14         $client->hmset('mytest:swooleredis_hmset2', 'aa', 'aa', 'bb', 'bb', function(swoole_redis $client, $result){
15             var_dump($result);
16         });
17     });

测试结果

1 [root@localhost root]# php index.php 
2 bool(true)
3 bool(false)
4 string(2) "OK"

文档

 

posted @ 2016-12-30 14:31  andy_chan  阅读(2256)  评论(0编辑  收藏  举报