Welcome! Log In Create A New Profile

Advanced

Re: lua parser and redis2 questions

June 04, 2011 04:26PM
Gregr, I'm using multibulk reply without pipelining. If it helps, here's a working sample.

I haven't used pipelining yet, since support for this a quite new (2011-04-03 for lua-redis-parser). Maybe try to update agentzh modules first.


#First save some test values to redis:
location /testluasetnginx
{
redis2_query hset testkey "testhash1" "value1";
redis2_query hset testkey "testhash2" "value2";
redis2_pass redisbackend;
}

#internal location for nonblocking fetch
location /testluagetnginx
{
redis2_query hgetall testkey;
redis2_pass redisbackend;
}

#test code
location /testluaparser
{
content_by_lua '
local replies = ngx.location.capture("/testluagetnginx")
local parser = require("redis.parser")
ngx.say("reply status is:",replies.status)
ngx.say("reply body is:",replies.body)
ngx.say("end of showresults")
local res,typ = parser.parse_reply(replies.body)
ngx.say("type=", typ)
ngx.say("res=", res[1])
ngx.say("res=", res[2])
ngx.say("res=", res[3])
ngx.say("res=", res[4])
';
}


#my results when using curl 'http://localhost/testluaparser'
reply status is:200
reply body is:*4
$9
testhash1
$6
value1
$9
testhash2
$6
value2

end of showresults
type=5
res=testhash1
res=value1
res=testhash2
res=value2
Subject Author Posted

lua parser and redis2 questions

gregr401 June 01, 2011 07:27PM

Re: lua parser and redis2 questions

logar.damir June 04, 2011 08:49AM

Re: lua parser and redis2 questions

Marcos Ortiz June 04, 2011 11:12AM

Re: lua parser and redis2 questions

Marcos Ortiz June 04, 2011 11:16AM

Re: lua parser and redis2 questions

agentzh June 04, 2011 11:22AM

Re: lua parser and redis2 questions

gregr401 June 04, 2011 02:15PM

Re: lua parser and redis2 questions

agentzh June 06, 2011 04:06AM

Re: lua parser and redis2 questions

logar.damir June 04, 2011 04:26PM

Re: lua parser and redis2 questions

gregr401 June 05, 2011 06:40PM

Re: lua parser and redis2 questions

agentzh June 06, 2011 04:12AM

Re: lua parser and redis2 questions

logar.damir June 06, 2011 07:16AM

Re: lua parser and redis2 questions

agentzh June 06, 2011 10:56AM

Re: lua parser and redis2 questions

gregr401 June 06, 2011 12:50PM

Re: lua parser and redis2 questions

agentzh June 06, 2011 09:16PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 41
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready