md5 as memcached_key

Dave Cheney dave at
Tue Jan 27 00:35:10 MSK 2009

md5 is not guaranteed to be unique, that is to say, two seperate  
inputs can generate the same hash, so you would need to use extra  
logic in your application if you wanted to guard against this remote  
possibility. I'm guessing the problem you are trying to solve is the  
memcache key has a limitation that is shorter than the possible  
request_uri ?



On 27/01/2009, at 4:43 AM, Geoff Geoff wrote:

> Hello,
> Does anyone know if nginx can calculate the md5 of a $request_uri
> string?  I'd like to set the $memcached_key as the md5 of the
> request_uri when passing requests for cached content to my memcached
> instance.
> In concept the directive might look like this;
>  location /testing {
>  set $memcached_key $md5($request_uri);
>  memcached_pass localhost:11211;
>  }
> Thanks!
> -- 
> Posted via

More information about the nginx mailing list