yes, can we have this please? we hit a bug in the latest php module, where keys passed to memcache greater than 250 are causing php to segfault. that's a bug a in the C module, but passing anything longer than 250 is a bug in this module.
chx's patch looks good to me, and we're using it in production.
Any idea on when this patch can be committed w/ justinrandell's modification? I have it deployed for a couple of smaller production sites and so far it has definitely fixed our memcache long key problem.
Is there a particular reason why the $full_key has to be urlencode()? Does memcache support binary key? In fact, urlencoding could make the key a lot longer. For example, if the key is a string "http://drupal.org/สวัสดีดรูพัลด้วยภาษาไทยก็ยาวเกินแล้ว", urlencode it would make it become "http://drupal.org/%E0%B8%AA%E0%B8%A7%E0%B8%B1%E0%B8%AA%E0%B8%94%E0%B8%B5%E0%B8%94%E0%B8%A3%E0%B8%B9%E0%B8%9E%E0%B8%B1%E0%B8%A5%E0%B8%94%E0%B9%89%E0%B8%A7%E0%B8%A2%E0%B8%A0%E0%B8%B2%E0%B8%A9%E0%B8%B2%E0%B9%84%E0%B8%97%E0%B8%A2%E0%B8%81%E0%B9%87%E0%B8%A2%E0%B8%B2%E0%B8%A7%E0%B9%80%E0%B8%81%E0%B8%B4%E0%B8%99%E0%B9%81%E0%B8%A5%E0%B9%89%E0%B8%A7" totaling 342 characters.
#1
related to #355299: errors like Failed to set key: cache_content-content%3A148498%3A148498
#2
yes, can we have this please? we hit a bug in the latest php module, where keys passed to memcache greater than 250 are causing php to segfault. that's a bug a in the C module, but passing anything longer than 250 is a bug in this module.
chx's patch looks good to me, and we're using it in production.
#3
woops, that patch should be:
<?phpreturn strlen(urlencode($full_key)) > 250 ? $prefix . $bin . '-' . md5($key) : urlencode($full_key);
?>
because the urlencode'd key can be longer than the straight full key.
#4
Any idea on when this patch can be committed w/ justinrandell's modification? I have it deployed for a couple of smaller production sites and so far it has definitely fixed our memcache long key problem.
-- M
#5
Hi,
Is there a particular reason why the $full_key has to be urlencode()? Does memcache support binary key? In fact, urlencoding could make the key a lot longer. For example, if the key is a string "http://drupal.org/สวัสดีดรูพัลด้วยภาษาไทยก็ยาวเกินแล้ว", urlencode it would make it become "http://drupal.org/%E0%B8%AA%E0%B8%A7%E0%B8%B1%E0%B8%AA%E0%B8%94%E0%B8%B5%E0%B8%94%E0%B8%A3%E0%B8%B9%E0%B8%9E%E0%B8%B1%E0%B8%A5%E0%B8%94%E0%B9%89%E0%B8%A7%E0%B8%A2%E0%B8%A0%E0%B8%B2%E0%B8%A9%E0%B8%B2%E0%B9%84%E0%B8%97%E0%B8%A2%E0%B8%81%E0%B9%87%E0%B8%A2%E0%B8%B2%E0%B8%A7%E0%B9%80%E0%B8%81%E0%B8%B4%E0%B8%99%E0%B9%81%E0%B8%A5%E0%B9%89%E0%B8%A7" totaling 342 characters.
#6
Hi,
I've tested memcache with keys in utf8 and it worked fine. So, there's no need to urlencode the key at all.
<?php
$memcache = new Memcache;
$memcache->connect("localhost", 11211);
$tmp_object = new stdClass;
$tmp_object->str_attr = "test";
$tmp_object->int_attr = 123;
$key = "blahชุมชนคอบอลอันดับ 1";
$memcache->set($key, $tmp_object, false, 10);
echo "Data from the cache:<br />\n";
var_dump($memcache->get($key));
?>
#7
subscribing