Py学习  »  Redis

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

guneysus • 5 年前 • 1685 次点击  

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
 
1685 次点击  
文章 [ 1 ]  |  最新文章 5 年前