nginx, echo module & lua

agentzh agentzh at gmail.com
Wed May 2 15:10:26 UTC 2012


On Wed, May 2, 2012 at 9:39 PM, Pierre <serarien at baqs.net> wrote:
>> But you're encouraged to try out ngx_lua's cosocket API to avoid
>> subrequests altogether. And the cosocket stuff does not have such
>> limitations.
> hmm, any more documentation about that ?

See the official documentation for ngx_lua cosocket:

    http://wiki.nginx.org/HttpLuaModule#ngx.socket.tcp

> More about: how to implement it in my lua scripts ?
>
> is that it ? :
>
> local tcp = ngx.socket.tcp
>
> function new(self)
>    return setmetatable({ sock = tcp() }, mt)
> end
> ?

See the lua-resty-redis, lua-resty-memcached, and lua-resty-mysql
libraries as examples:

    https://github.com/agentzh/lua-resty-redis
    https://github.com/agentzh/lua-resty-memcached
    https://github.com/agentzh/lua-resty-mysql

bigplum has been working on lua-resty-mongol:

    https://github.com/bigplum/lua-resty-mongol

I'm not sure about its state, but you can read the document or contact
the author directly.

Best regards,
-agentzh



More information about the nginx mailing list