tags:

views:

114

answers:

1

I am having a problem with my $memcached_keys being too long in my .conf file for nginx. I am using the memcached module but some of my urls are too long. I am in the process of trying to user MD5 hashes of the urls instead but in the meantime I was just wondering if there was a way I could check on the length of a string stored in a variable.

so:

set $memcached_key "byp-$uri";
if ($args) {
    set $memcached_key "byp-$uri?$args";
}

if (len($memcache_key) < 250) {
     memcached_pass 127.0.0.1:11211;
     error_page 404 = @cache_miss;
     error_page 502 = @cache_miss;
}
else {
    pass to @cache_miss;
}
A: 

I'm not positive, but I don't think it can be done within the nginx config language. I suspect it would be documented here if it existed, and I don't see anything.

Burke