sgrimm at facebook.com
Fri Jan 5 19:15:09 UTC 2007
I believe the key length is stored in a 1-byte field in the item data
structure at the moment. See memcached.h. You'll need to change it from
"unsigned char" to "short" or "int" if you want keys longer than 256
characters. I *think* it should work if you do that and increase
KEY_MAX_LENGTH as you've done, but I've never tried it. (Don't have the
source in front of me at the moment or I'd tell you the field name.)
The length is 1 byte because (a) most people don't need long cache keys
-- I think our longest one is maybe 40 bytes -- and (b) if your cache
has tens of millions of items, saving a couple bytes here and there
actually makes a measurable difference in cache capacity.
Renato Silveira wrote:
> 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?
More information about the memcached