is it possible to connect to memcached and check in access phase?

Manlio Perillo manlio_perillo at libero.it
Mon Feb 23 15:46:25 MSK 2009


Huy Phan ha scritto:
> Hi Manilo,
> 
> Thank you for your quick reply :)
> I'm checking the source code of some memcached client from 
> google code. 
> Hope I can find something here.
> In fact I've already used the code of ngx_http_memcached_module
> (using upstream) for my workflow, and it works, but not in the 
> access phase.
> I still don't get the point when you said we can use 
> asynchronous in access phase. Because the code is something 
> like this :
> 
> [...]
>
> How can the handler function wait for the result of 
> callback function in this case ?
> 

It should be possible.
The access phase "manager" seems to support a return value of NGX_AGAIN 
and NGX_DONE.

When one of these values are returned, Nginx will not try to execute the 
next handler.

Unfortunately there are no access phase module that do asynchronous I/O, 
so you should do some tests.

I **suspect** that you should call ngx_http_handler, when the Nginx 
event module notifies you that the connection to the memcached server is 
ready for reading.
Nginx will call you handler again.

But I'm not sure.


 > [...]



Manlio





More information about the nginx mailing list