You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to memcached
Hi everybody,
As far as I know the maximum key size for an item in memcached is 250
and can be extended to 255. I've just installed the lastest version of
memcached on my Ubuntu and tried to set an item with length of 300 and
600. I was surprise that it was set correctly, even using get/set
command, C/C++ library libmemcached or memcached extension of PHP.
I checked the source code, in memcached.h :
typedef struct _stritem {
.................
uint8_t nkey; /* key length, w/terminating null and
padding */
................
} item;
the type of key length is still uint8_t which is 1 byte, how can it
manage with key length 300 and 600 ?
Syed Ali
unread,
Apr 26, 2009, 11:19:39 AM4/26/09
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to memc...@googlegroups.com
Did you just put an item with that 300 chars key and got it back. If so, it could have been truncated to 255 and since you didnt submit another item with the same first 255 chars in the key, you got it back...
Makes sense?
Regards, Zer0frequency
-- Best, - Ali
Huy Phan
unread,
Apr 26, 2009, 11:45:53 AM4/26/09
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to memc...@googlegroups.com
I wrote a PHP script to test my memcached. What I did is that setting 100 000 items (that have 10 different values) , then get them back and check if the values are correct or not. You can check the script at : http://pastebin.com/fb443de3
All the items I got back are correct after I run this script.
Huy Phan
unread,
Apr 26, 2009, 1:53:20 PM4/26/09
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to memc...@googlegroups.com
Sorry please ignore my last message, it was going wrong, what i set was the value, not the key
Brian Moon
unread,
Apr 26, 2009, 11:59:29 PM4/26/09
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to memc...@googlegroups.com
pecl/memcache will handle your keys being too long. I forget what it does (md5 maybe) but it silently deals with it.