openresty中lua+redis,关于lua查询redis方法的手册,我在用zrangebyscore时的分页,resty只支持字符串,有相关说明文档吗?

 local aSetId = instance:zrangebyscore('jsonjjmatch_ware_dict_usually', iTimeLine, iTime)

这样能获取整个,但是我需要 limit取,我看redis.lua中只能传字符串,

 local aSetId = instance:zrangebyscore('jsonjjmatch_ware_dict_usually', iTimeLine, iTime,{limit={0, 10}})

报错:2013/07/04 16:58:19 [error] 19015#0: *2160 lua handler aborted: runtime error: /usr/local/openresty/lualib/resty/redis.lua:196: bad argument #1 to 'len' (strin
      g expected, got table), client: 192.168.20.115, server: localhost, request: "GET /get_ware_dict?waretype=1&id=33&wareid= HTTP/1.1", host: "localhost:85"

Foyon Foyon
发帖于 2年前
4回/1743阅

按票数排序  显示最新答案   共有4个答案 (最后回答: 2年前)

    0
  • Foyon

    你是指用openresty时候,不报错?

    nginx配置日志报错等级,notice,或者更低点等级 debug

    error_log  logs/error.log  notice;

    评论(0)| 引用此答案| 举报 (2013-07-24 10:28)
  • 0
  • xianguiquan
    开发  OpenResty  lua模块是,不提示详细错误,请问怎样调试??
    评论(0)| 引用此答案| 举报 (2013-07-23 17:10)
  • 0
  • Foyon
    Re: 关于zrangebyscore的limit问题 
    发件人:agentzh <agentzh@gmail.com>    
    时   间:2013年7月8日(星期一) 下午2:45 (UTC-07:00 休斯顿、底特律时间)
    收件人:
    小凡  <123811754@qq.com>
    抄   送:
    openresty  <openresty@googlegroups.com>
    Hello!

    On Thu, Jul 4, 2013 at 1:32 AM, 小凡 wrote:
    > 您好,最近学习如何使用openresty,
    > lua+redis
    > 用到这个函数 zrangebysocre,limit的参数怎么传》?
    >   --local aSetId =
    > instance:zrangebyscore('jsonjjmatch_ware_dict_usually',iTimeLine, iTime)
    >    local aSetId = instance:zrangebyscore('jsonjjmatch_ware_dict_usually',
    > iTimeLine, iTime, {limit={0,10}})
    2013/07/04 15:44:20 [error] 19003#0: *2004 lua handler aborted: runtime
    > error: /usr/local/openresty/lualib/resty/redis.lua:196: bad argument #1 to
    > 'len' (string expected, got table), client: 192.168.20.115, server:
    > localhost, request: "GET /get_ware_dict?waretype=1&id=33&wareid= HTTP/1.1",
    > host: "localhost:85"
    >
    > 只能传字符串?

    lua-resty-redis 的命令格式与 redis 标准命令完全相同:

         http://redis.io/commands/zrangebyscore

    比如 redis 官方文档中的这个例子

        ZRANGEBYSCORE zset (1 5

    在 Lua 中便等价于调用

        local res, err = instance:zrangebyscore("zset", "(1", "5")

    > 关于lua 访问redis的手册,或者文档能否提供一些资料?

    除了上面给出的 redis 命令的官方手册,还有就是 lua-resty-redis 自身的 README 文档:

         https://github.com/agentzh/lua-resty-redis#name

    同时抄送给 openresty 中文邮件列表: https://groups.google.com/group/openresty

    建议你加入此列表并总是在那里交流这样的问题,谢谢合作!

    Best regards,
    -agentzh
    --- 共有 1 条评论 ---
    • Foyon openresty作者回复了我的邮件,非常感谢!!! (2年前)   回复
    评论(1)| 引用此答案| 举报 (2013-07-09 05:52)
  • 0
  • Foyon

    local aSetId = instance:zrangebyscore('jsonjjmatch_ware_dict_usually', iTimeLine, 'limit', '0', '10')

    这样写。最好能有相关文档

::...
免责声明:
当前网页内容, 由 大妈 ZoomQuiet 使用工具: ScrapBook :: Firefox Extension 人工从互联网中收集并分享;
内容版权归原作者所有;
本人对内容的有效性/合法性不承担任何强制性责任.
若有不妥, 欢迎评注提醒:

或是邮件反馈可也:
askdama[AT]googlegroups.com


订阅 substack 体验古早写作:


点击注册~> 获得 100$ 体验券: DigitalOcean Referral Badge

关注公众号, 持续获得相关各种嗯哼:
zoomquiet


自怼圈/年度番新

DU22.4
关于 ~ DebugUself with DAMA ;-)
粤ICP备18025058号-1
公安备案号: 44049002000656 ...::