REDIS2 Addon, Query LRANGE Support?

Alexander Kunz akunz at ntmedia.de
Wed Feb 16 21:14:18 MSK 2011


Hello,

is it possible to query a LRANGE request with the redis2 addon? I try this:

     location /redis {
         set_unescape_uri $query $arg_query;
         redis2_raw_query $query;
         redis2_pass 127.0.0.1:6379;
     }

     location /redis-test {
             content_by_lua '
                 local parser = require("redis.parser")
                 local get = ngx.location.capture("/redis", { args = { 
query = "LRANGE mylist 0 2\\r\\n" } } )
                 local res, typ = parser.parse_reply(get.body)

                 ngx.print(res)
             ';
     }

But i get this error:

[error] 25328#0: *19 Redis server returns invalid response at 18 near "*3
$4
foo7
$4
foo6
$4
foo5
" while reading response header from upstream

The result in my error log is ok, any chance to get this result into a 
lua structure in nginx?

Thanks for any hint.

Alexander








More information about the nginx mailing list