当前位置:网站首页>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);}
边栏推荐
猜你喜欢
随机推荐
js 之 Object.defineProperty()
线程池(线程池介绍与使用)
PHP入门(自学笔记)
百度定位js API
二维码生成API接口,可以直接作为A标签连接
(1)Thinkphp6入门、安装视图、模板渲染、变量赋值
1.11今日学习
IP access control: teach you how to implement an IP firewall with PHP
项目中遇到的问题
[vite] Failed to parse source for import analysis because the content contains invalid JS syntax.
我的小笔记 =》其他东东
---static page---
暴力方法求解(leetcode14)查找字符串数组中的最大公共前缀
IO stream, encoding table, character stream, character buffer stream
如何根据地图上的两个坐标点来确定方向
When PHP initiates Alipay payment, the order information is garbled and solved
区间问题 : 今年暑假不AC
一分种一起来了解Vite的基础
我的小笔记 =》原生微信小程序
The querystring module