Using the memcache module to your advantage

Josh Turmel jturmel at
Thu Apr 2 07:09:51 MSD 2009

We love the memcached module with Nginx, one thing we rewrite all of our initial
requests (that don't have args and are pretty urls into a structure that does
have args.)

Example: rewrites to

It seems as such that when Nginx initially gets this requests the $args variable
is empty so it never initializes the variable in the memcached module?  Hard to
tell, just guessing here.

So when we do something like this.

set $memcached_key $uri$is_args$args;
memcached_pass localhost:11211
error_page 404 /fallback;

That it looks for the key "/index.php?" with $args not on the string.  This
seems to only be a memcached module problem however, because if you comment out
the memcached lines and do an "add_header "test_header" $args; they will contain
your proper args from the rewrite.

We started a post a week or so ago and never heard from anyone, just wondering
if anyone has experienced this or knows a fix, Igor? :)

Thank you,

More information about the nginx mailing list