acl-dev / acl

C/C++ server and network library, including coroutine,redis client,http/https/websocket,mqtt, mysql/postgresql/sqlite client with C/C++ for Linux, Android, iOS, MacOS, Windows, etc..
https://acl-dev.cn
GNU Lesser General Public License v3.0
2.83k stars 937 forks source link

keys_pattern function inside redis_key.cpp is not working correclty #299

Closed tm185121 closed 1 year ago

tm185121 commented 1 year ago

Sub: keys_pattern function inside redis_key.cpp is not working correclty

I have a cache of type Settings at zero index. Inside that I have 4 key, values.

== 127.0.0.1:6379[2]> select 0 OK 127.0.0.1:6379> keys 1) "Settings_2022.12.12.19.03.15.647.json" 2) "Settings_2022.12.12.17.46.29.028.json" 3) "Settings_2022.12.14.13.55.25.880.json" 4) "Settings2022.12.12.21.15.44.710.json" 127.0.0.1:6379> keys Settings 1) "Settings_2022.12.12.19.03.15.647.json" 2) "Settings_2022.12.12.17.46.29.028.json" 3) "Settings_2022.12.14.13.55.25.880.json" 4) "Settings_2022.12.12.21.15.44.710.json"

However , when I am trying to get the keys matching the pattern -> "Settings_*" using keys_pattern function which is inside redis_key,cpp..it is always retuning "-1". Attached the debuggin screenshot for reference. Could you please comment. Redis_key issue

zhengshuxin commented 1 year ago

When some error happened, you can use redis.result_error() to get the error info.

tm185121 commented 1 year ago

Hi, Thanks for your reply. I did print that error message...and i see it says => "The operation completed successfully". However, the number of entries matching the key is -1.

Its seen in the screenshot attached too

Thanks Tri

tm185121 commented 1 year ago

Got the output using acl::redis. Closing this issue