社区所有版块导航
Python
python开源   Django   Python   DjangoApp   pycharm  
DATA
docker   Elasticsearch  
aigc
aigc   chatgpt  
WEB开发
linux   MongoDB   Redis   DATABASE   NGINX   其他Web框架   web工具   zookeeper   tornado   NoSql   Bootstrap   js   peewee   Git   bottle   IE   MQ   Jquery  
机器学习
机器学习算法  
Python88.com
反馈   公告   社区推广  
产品
短视频  
印度
印度  
Py学习  »  Redis

如何从表值Redis Lua脚本中检索值

guneysus • 5 年前 • 1569 次点击  

127.0.0.1:6379> eval 'local r= redis.call("ZRANGEBYSCORE", "iprange:locations", 34625535, "+inf", "LIMIT", 0, 1); return type(r);' 0
"table"
127.0.0.1:6379> eval 'local r= redis.call("ZRANGEBYSCORE", "iprange:locations", 34625535, "+inf", "LIMIT", 0, 1); return r;' 0
1) "{\"countryCode\": \"IT\", \"countryName\": \"Italy\"}"

我只想提取 countryValue

尝试 return r.countryCode; return r["countryCode"]; 但他们都回来了 (nil)

只是想把这个简单的任务委托给Redis Lua脚本引擎。

Python社区是高质量的Python/Django开发社区
本文地址:http://www.python88.com/topic/53971
 
1569 次点击  
文章 [ 1 ]  |  最新文章 5 年前