is it possible to connect to memcached and check in access phase?
manlio_perillo at libero.it
Sun Feb 22 23:16:07 MSK 2009
Huy Phan ha scritto:
> Is the DNS resolver module available on nginx so that I can check ?
It is not a module.
> The main point of my workflow is that everything should be done at access
> phase, so asynchornous is useless in this case isn't it ?
No, it is not useless.
Asynchronous means that you don't block the whole Nginx process while
waiting data from the memcached server.
However, if the memcached serve is on localhost, and since the data you
exchange is small, it should be safe to use socket in blocking mode.
> When you said memcached client, doesn't it mean doing self-coding network
> programming inside nginx ?
But you can of course use an existing memcached client, if it is
implemented as a C library.
The new libmemcached also seems to support an asynchronous interface.
But, really, implementing a client that only do a `get` request is not
hard, if you use socket in blocking mode.
See the source code of the ngx_http_memcached_module.
> I still prefer using the code done by nginx to
> prevent risks if there's any.
The are no risks.
And you can't use the code from the existing memcached module, because
it is implemented so that the data returned by a `get` request to a
memcached server is sent directly to the HTTP client.
More information about the nginx