当前位置:网站首页>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);}
边栏推荐
猜你喜欢
The Error in the render: "TypeError: always read the properties of null '0' (reading)" Error solution
TCP通信程序
SQL: DDL, DML, DQL, DCL corresponding introduction and demonstration
点名系统和数组元素为对象的排序求最大值和最小值
js eventLoop 事件循环机制
Thread Pool (Introduction and Use of Thread Pool)
1.8今日学习
SQL classification, DQL (Data Query Language), and corresponding SQL query statement demonstration
ES6数组的扩展方法map、filter、reduce、fill和数组遍历for…in for…of arr.forEach
微信小程序云开发如何将页面生成为pdf?
随机推荐
由中序遍历和前序遍历得到后序遍历(树的遍历)
使用PHPMailer发送邮件
每日五道面试题总结 22/7/19
Common methods of js array deduplication
Advanced gradient of skeleton effect, suitable for waiting for pictures
微信小程序九宫格抽奖和转盘抽奖的实现
每日五道面试题总结 22/7/20
每日五道面试题总结 22/7/21
L1-039 古风排版(C)
canvas--pie chart
SQL:DDL、DML、DQL、DCL相应介绍以及演示
解决MySQL创建子视图并查看的时候,字符集报错问题
我的小笔记 =》原生微信小程序
[symfony/finder]最好用的文件操作库
MySql高级 -- 约束
debian 10 nat and routing forwarding
正则笔记(1)- 正则表达式字符匹配攻略
IO streams, byte stream and byte stream buffer
IP门禁:手把手教你用PHP实现一个IP防火墙
Baidu positioning js API