memcached configuration issue

Tom Churchill tom at earthscape.com
Tue Nov 11 08:19:52 MSK 2008


I hope you will forgive my asking for help on what I assume is a fairly
obvious error of some sort -- but it's one I'm afraid I can't figure out.

Basically, we have a cherrypy back end server that will resolve layer names
to IP address, handling requests of the form:

   /resolve?layer=test

or

  /resolve?layer=es_layer_23

The back end server sets a memcache key/value pair so that the next time
around, nginx can avoid the "@cache_miss" proxy pass.

For the most part, all works well -- if I request the name of a key in the
memcached, ("test", for example) -- it gets returned.  Likewise, if I
request a key NOT in memcached, the request gets sent to my server.

However, there are a couple of classes of layers that can be handled
generically:  ANY layer starting with "es_" or "api_" will go to the same
host: So no need to clutter memcached, right?  Just convert the key so that
it is identical for all such requests...

When I attempt to do so using the code fragment below, however, I get what I
believe is unusual behavior -- requests for anything starting with "es_" or
"api_" return nothing -- no HTTP headers, no nothing.

Any thoughts on why?

Thanks,

--Tom


        location /resolve {
                default_type  text/html;

                set $memcached_key "api:/resolve?$args";
                if ($args ~ "layer=es_") {
                        set $memcached_key "api:/resolve?layer=es_";
                }
                if ($args ~ "layer=api_") {
                        set $memcached_key "api:/resolve?layer=api_";
                }
                memcached_pass localhost:11211;
                error_page 404 = @cache_miss;
        }
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://nginx.org/pipermail/nginx/attachments/20081110/9bfe30c5/attachment.html>


More information about the nginx mailing list