为哈希表 key 中的指定字段的整数值加上增量 increment 。
<?php
//连接本地的 Redis 服务
$redis = new Redis();
$redis->connect('10.1.3.15', 6379);
$redis->auth('kuaicdn_redis_passwd');
$redis->flushAll();
$redis->hMSet('hast-test-hmset1',array(
'key1'=>1,
'key2'=>1,
));
$ret['cmd']=$redis->hIncrBy('hast-test-hmset1','key2',5);
$ret['src']=$redis->hGetAll('hast-test-hmset1');
print_r($ret);
?>
返回值:
Array
(
[cmd] => 6
[src] => Array
(
[key1] => 1
[key2] => 6
)
)