6 messages in ru.sysoev.nginxRe: md5 as memcached_key
FromSent OnAttachments
Geoff GeoffJan 26, 2009 9:43 am 
Dave CheneyJan 26, 2009 1:34 pm 
Geoff GeoffJan 26, 2009 2:46 pm 
Sergio BruderJan 26, 2009 3:25 pm 
MerlinJan 26, 2009 8:01 pm 
Xavier GrangierFeb 3, 2009 7:09 am 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:Re: md5 as memcached_keyActions...
From:Merlin (mer@mahalo.com)
Date:Jan 26, 2009 8:01:22 pm
List:ru.sysoev.nginx

I agree that since this is not a cryptographic application, the fact that md5 has some collisions is less relevent, maybe even irrelevent unless you have a very large set of URIs you need to pull from memcached uniquely.

Due to the way nginx configuration and modules work, I am not sure that it is viable to have $md5(SOMETHING) return md5. A more likely (and probably relatively easy to implement) solution might be something like this:

location /testing { set_md5 $memcached_key $request_uri; memcached_pass localhost:11211; }

Perhaps I'll take a shot at it later on in the week :).

On Mon, Jan 26, 2009 at 3:25 PM, Sergio Bruder <bru@haxent.com.br> wrote:

Em 26/01/2009, às 20:47, Geoff Geoff escreveu:

Dave Cheney wrote:

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 ?

Cheers

Thanks Dave,

The problem is that memcached will not allow certain characters in the key name - so I thought it might be simpler to just store the md5 of the actual request_uri.

There are the theoretical chance of colision, yes, but you probably can use it anyway without a practical chance of colision.