Set generated PHP output to Memcached server by Nginx transparently

jkuang nginx-forum at
Wed Aug 18 19:26:24 MSD 2010

Dayo, thank you for the response.  It seem that is what I am looking
for.  I am going to try it out and see if it works.  

Given the fact that this is still on the "bleeding edge" side of Nginx
usage, I am thinking it might be better off if I will just use a
"middleware" PHP to handle the update to the memcached server.

1) If there is PHP output in the Memcached server cluster given $uri,
use it  (with header stuff set)

2) If not, REWRITE the URL for

This memcached_update.php will open up a output buffer, perform a url
get for the content of the original url, store the buffered content in
memcached server (unfortunately that means this PHP will need to perform
memcached server look up and cluster management in a clustered memcached
environment) and return the content

3) Next time the same location is requested, we should have the content
available in the memcached server cluster.

This should not have impact on the original application as the
"middleware" PHP is generic.  But still it is a messy hack.  It is not

I really hope NginxHttpMemcachedModule or NginxHttpMemcModule should
bundle this critical capability in the modules directly.  It seems so
obviouos this job belongs to these two modules.

-- Jin Kuang

Posted at Nginx Forum:,120614,121015#msg-121015

More information about the nginx mailing list