当前位置:网站首页>easyswoole uses redis to perform geoRadiusByMember Count invalid fix
easyswoole uses redis to perform geoRadiusByMember Count invalid fix
2022-08-02 03:53:00 【auspi12341】
The author of this bug has been updated: https://github.com/easy-swoole/redis/pull/23/files
The reason for the problem, the parameter list of geoRadiusByMember is as follows, when using Count, you need to bring Count X number of pieces, for example, if you need 5 pieces, it is Count 5,
GEORADIUSBYMEMBER key member radius m|km|ft|mi [WITHCOORD] [WITHDIST] [WITHHASH] [COUNT count] [ASC|DESC] [STORE key] [STOREDIST key]And the methods provided by the framework
geoRadiusByMember($key, $location, $radius, $unit, $withCoord, $withDist, $withHash, $count, $sort, $storeKey,$storeDistKey);There is a count parameter, but no matter how you set it, it has no effect. Setting the array also needs to report errors, track problems, and locate
vendor/easyswoole/redis/src/Client.php file method, here is the special case considering count,
public function sendCommand(array $commandList): bool{$argNum = count($commandList);$str = "*{$argNum}\r\n";foreach ($commandList as $value) {$len = strlen($value);$str = $str . '$' . "{$len}\r\n{$value}\r\n";}return $this->send($str);}Modify as follows, you can return normally
public function sendCommand(array $commandList): bool{$argNum = 0;foreach ($commandList as $data ){if(is_array($data)){$argNum = $argNum + (count($data) + 1);}else{$argNum++;}}$str = "*{$argNum}\r\n";foreach ($commandList as $value) {if(is_array($value)){foreach ($value as $key => $values) {$len = strlen($key);$str = $str . '$' . "{$len}\r\n{$key}\r\n";$len = strlen($values);$str = $str . '$' . "{$len}\r\n{$values}\r\n";}}else{$len = strlen($value);$str = $str . '$' . "{$len}\r\n{$value}\r\n";}}return $this->send($str);}边栏推荐
猜你喜欢
随机推荐
Advanced gradient of skeleton effect, suitable for waiting for pictures
每日五道面试题 2022/7/27
js eventLoop 事件循环机制
js 中this指向
TCP communications program
由中序遍历和后序遍历得到前序遍历(树的遍历)
easyswoole 使用redis执行geoRadiusByMember Count无效修复
Small program van-cell line wrapping can be left-aligned
1.8今日学习
环形链表---------约瑟夫问题
4.PHP数组与数组排序
DOM manipulation---magnifying glass case
ES6三点运算符、数组方法、字符串扩展方法
微信小程序怎么批量生成带参数的小程序码?
ES6介绍+定义变量+不同情况下箭头函数的this指向
微信小程序开发视频加载:[渲染层网络层错误] Failed to load media
IO流、 编码表、 字符流、 字符缓冲流
微信小程序自定义swiper轮播图面板指示点|小圆点|进度条
数组的高级操作
1.6一些今日学习









