Using the memcache module to your advantage

Josh Turmel jturmel at gmail.com
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:

www.example.com/forum/posts/235?sort=desc rewrites to
www.example.com/index.php?framework_uri=forum/posts/235&sort=desc

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,
Josh






More information about the nginx mailing list