<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">

<head>
<meta http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<meta name=Generator content="Microsoft Word 12 (filtered medium)">
<style>
<!--
 /* Font Definitions */
 @font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:Verdana;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.gmailquote
        {mso-style-name:gmail_quote;}
span.e
        {mso-style-name:e;}
span.EmailStyle19
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;}
@page Section1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.Section1
        {page:Section1;}
-->
</style>
<!--[if gte mso 9]><xml>
 <o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
 <o:shapelayout v:ext="edit">
  <o:idmap v:ext="edit" data="1" />
 </o:shapelayout></xml><![endif]-->
</head>

<body lang=EN-US link=blue vlink=purple>

<div class=Section1>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>  You&#8217;re wasting your time. Use a MD4 or MD5 hash and
base64-encode the result and use as the key. The computational cost for
calculating the hash will be lower than the time taken transmitting your key.<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>/Stefan<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<div style='border:none;border-left:solid blue 1.5pt;padding:0cm 0cm 0cm 4.0pt'>

<div>

<div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm'>

<p class=MsoNormal><b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span
style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>
memcached-bounces@lists.danga.com [mailto:memcached-bounces@lists.danga.com] <b>On
Behalf Of </b>Renato Silveira<br>
<b>Sent:</b> 07 January 2007 15:05<br>
<b>To:</b> Marc<br>
<b>Cc:</b> memcached@lists.danga.com<br>
<b>Subject:</b> Re: Key Size<o:p></o:p></span></p>

</div>

</div>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<p class=MsoNormal style='margin-bottom:12.0pt'>Thank you all for the answers!<br>
First of all I´ll try to increase the key size as Steve said. Because, the
application that I´m working is perfomance oriented, so I think that we would
have some problems with the overhead of Sha or MD5. <br>
I´m using java api of memcached as the client. The problem of whitespace in the
url is solved because the client api use a URLEncoder in the key before the
store the objects.<br>
Well, as I´ll try this first approach and I tell you if it works! <br>
<br>
tks again!<br>
<br>
Renato<br>
<br>
<br>
<br>
<br>
<br>
<o:p></o:p></p>

<div>

<p class=MsoNormal><span class=gmailquote>On 1/5/07, <b>Marc</b> &lt;<a
href="mailto:Marc@facebook.com">Marc@facebook.com</a>&gt; wrote:</span><o:p></o:p></p>

<div>

<p class=MsoNormal><span style='font-size:9.0pt;font-family:"Verdana","sans-serif"'>I
misspoke about whitespace...the server will drop it, not the client.<o:p></o:p></span></p>

<div>

<p class=MsoNormal style='margin-bottom:12.0pt'><span style='font-size:9.0pt;
font-family:"Verdana","sans-serif"'><br>
<br>
<br>
<span class=e>On 1/5/07 11:25 AM, &quot;Marc&quot; &lt;<a
href="mailto:Marc@facebook.com" target="_blank">Marc@facebook.com</a>&gt;
wrote:</span><o:p></o:p></span></p>

</div>

<div>

<blockquote style='margin-top:5.0pt;margin-bottom:5.0pt'>

<p class=MsoNormal style='margin-bottom:12.0pt'><span style='font-size:9.0pt;
font-family:"Verdana","sans-serif"'>I see two possible problems. &nbsp;First
&#8211; as you note &#8211; the client needs to deal with the increase too.
&nbsp;I'm not sure which one you're using but for most implementations, the
default read -buf &nbsp;size for GET results is 250+1 so, if memcached is
returning results like: <br>
&nbsp;&nbsp;&nbsp;&nbsp;VALUE very&lt;250&gt;long_key 0 3\r\nxxx\r\nEND <br>
It very well may be the case that the client punts after scanning &quot;VALUE
very&lt;250&gt;&quot; without seeing either space (\b) or CRLF (\r\n)<br>
<br>
Second, if you have spaces in your URL this will cause similar problems.
&nbsp;The client will take the following:<br>
&nbsp;&nbsp;&nbsp;&nbsp;VALUE <a href="http://url/key/with" target="_blank">http://url/key/with</a>
white space 0 3\r\nxxx\r\nEND<br>
<br>
as the value for key &quot;<a href="http://url/key/with%C2%B2" target="_blank">http://url/key/with&quot;</a>
and not finding a corresponding client request for that key will &nbsp;most
likely discard it. <br>
<br>
On 1/5/07 11:08 AM, &quot;Renato Silveira&quot; &lt;<a
href="mailto:renatosilveira@gmail.com" target="_blank">renatosilveira@gmail.com</a>&gt;
wrote:</span><o:p></o:p></p>

<p class=MsoNormal style='margin-bottom:12.0pt'><span style='font-size:9.0pt;
font-family:"Verdana","sans-serif"'>Hi,<br>
<br>
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? <br>
<br>
tks!<br>
<br>
Renato</span><o:p></o:p></p>

<p class=MsoNormal style='margin-bottom:12.0pt'><o:p>&nbsp;</o:p></p>

</blockquote>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

</div>

</div>

</div>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

</div>

</div>

</body>

</html>