lua parser and redis2 questions

gregr401 nginx-forum at nginx.us
Thu Jun 2 03:27:46 MSD 2011


Hi Folks -

Looking for some examples or hints in order to leverage lua_parser &&
redis2.  To date, I've been using httpredis and content_by_lua code to
perform a number of simple 'get's which has worked well.  Now, I'd like
to pipeline a number of redis requests together in order to leverage
'auth' within redis and eventually pipeline numerous 'get's at once.

This is what I have working so far, appreciate any assistance or
commentary...

location /redis2 {
                set $key $http_host;
                redis2_query auth foobar;
                redis2_query get $key;
                redis2_pass redis-backend;
}

This auth + get works great and yields the following as expected:

+OK
$12
blahblahblah


Goal 1:
I'd like to be able to strip out the +OK\r\n$12\r\n and be left with the
actual value of blahblahblah.  Hints or example?


Goal 2:
Eventually I'd like to be able to pipeline an 'auth' plus numerous
'gets' together and leverage each value, if a $-1 isn't returned for a
'get', ie:
  location /redis2 {
                set $key $http_host;
                set $key2 $http_host:some_arbitrary_value;
                redis2_query auth foobar;
                redis2_query get $key;
                redis2_query get $key2;
                redis2_pass redis-backend;
  }


Thanks in advance for any pointers...

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,203154,203154#msg-203154




More information about the nginx mailing list