Key Size

Brian Moon brianm at
Fri Jan 5 19:18:07 UTC 2007

Renato Silveira wrote:
> Hi,
> I´m using memcached as a URL keyword cache. The url is the key and the 
> cached object is a string with relevant keywords of the site. Well, it´s 
> working fine for my purpose. The only problem is the limit of key size 
> to 250 bytes(because there can be url bigger than 250 bytes). Well, I 
> tried to increase the value of the constant KEY_MAX_LENGTH to 2048 
> bytes. I recompile memcached and it´s not working. Should I have to make 
> any modification on the client API? Does anyone can helpme with this issue?
> tks!
> Renato

I suggest you use md5() or sha1() of the URI or both.  We use a
combination of the two to have a 64 character (nearly)unique key for URI
and SQL based cache.

psuedo (php):

$key =


Brian Moon
It's good to be cheap =)

More information about the memcached mailing list