测试代码
$redisClass = new Redis();
$redisClass->connect('127.0.0.1', 6379, 1);
$result = $redisClass->hmset('mytest:phpredis1', ['aa' => 'aa', 'bb' => 'bb']); // 原生的支持数组
var_dump($result);
5
$redis = new swoole_redis();
$redis->connect('127.0.0.1', 6379,
function (swoole_redis $client, $result) {
$client->hmset('mytest:swooleredis_hmset1', ['aa' => 'aa', 'bb' => 'bb'], function(swoole_redis $client, $result){
var_dump($result);
}); $client->hmset('mytest:swooleredis_hmset2', 'aa', 'aa', 'bb', 'bb', function(swoole_redis $client, $result){
var_dump($result);
});
});
测试结果
[root@localhost root]# php index.php
bool(true)
bool(false)
string(2) "OK"
文档