memcache key double escaped

Maxim Dounin mdounin at
Thu Feb 26 16:17:02 MSK 2009


On Thu, Feb 26, 2009 at 01:40:58PM +0100, Xavier Grangier wrote:

> Hello,
>> It's expected as nginx escapes $memcached_key before passing it to
>> memcached.  It escapes " ", "%", %00-%1F.
> Thanks for your reply.  Yes I could see from source that memcache module 
> escape the key.
> But seems to me weird behaviour to escape values that are already  
> escaped.

The memcached module have to be able to deal with mostly arbitrary 
$memcached_key, and therefore it has to escape space and control 
characters to avoid violation of memcached protocol.  To make this 
escaping one-to-one it's also required to escape '%'.

> It's not a problem if memcache user notice this. I'm pretty  
> sure this leads to lots of cache miss.

I agree that this deserves a bit more documentation.

Maxim Dounin

More information about the nginx mailing list