<HTML><BODY style="word-wrap: break-word; -khtml-nbsp-mode: space; -khtml-line-break: after-white-space; "><DIV><BR class="khtml-block-placeholder"></DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre">        </SPAN>My proposal (and implementation) supports both. If you want it to automatically create stuff for you, you just specify what the new value will be. If you don't want it to generate values for you, it doesn't have to.</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre">        </SPAN>Are there semantics you're looking for that aren't covered here?</DIV><BR><DIV><DIV>On Jul 28, 2007, at 0:28, Earl Cahill wrote:</DIV><BR class="Apple-interchange-newline"><BLOCKQUOTE type="cite"><SPAN class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><DIV style="font-family:times new roman, new york, times, serif;font-size:12pt; font-family: times new roman; font-size: 16px; "><DIV style="font-family: times new roman,new york,times,serif; font-size: 12pt;; font-family: times new roman; font-size: 16px; "><SPAN class="Apple-style-span" style="font-family: times new roman; font-size: 16px; ">While we're here, perhaps I am alone on this, or maybe it is just the perl client, but I think incr and decr should do their thing for new keys. Currently, in my experience, they return undef for new keys. I checked in my code and act accordingly.</SPAN><BR style="font-family: times new roman; font-size: 16px; "><BR style="font-family: times new roman; font-size: 16px; "><SPAN class="Apple-style-span" style="font-family: times new roman; font-size: 16px; ">Thoughts?</SPAN><BR style="font-family: times new roman; font-size: 16px; "><BR style="font-family: times new roman; font-size: 16px; "><SPAN class="Apple-style-span" style="font-family: times new roman; font-size: 16px; ">Earl</SPAN><BR style="font-family: times new roman; font-size: 16px; "><BR style="font-family: times new roman; font-size: 16px; "><DIV style="font-family: times new roman,new york,times,serif; font-size: 12pt;; font-family: times new roman; font-size: 16px; "><SPAN class="Apple-style-span" style="font-family: times new roman; font-size: 16px; ">----- Original Message ----</SPAN><BR style="font-family: times new roman; font-size: 16px; "><SPAN class="Apple-style-span" style="font-family: times new roman; font-size: 16px; ">From: Dustin Sallings <<A href="mailto:dustin@spy.net">dustin@spy.net</A>></SPAN><BR style="font-family: times new roman; font-size: 16px; "><SPAN class="Apple-style-span" style="font-family: times new roman; font-size: 16px; ">To: Memcached list <<A href="mailto:memcached@lists.danga.com">memcached@lists.danga.com</A>></SPAN><BR style="font-family: times new roman; font-size: 16px; "><SPAN class="Apple-style-span" style="font-family: times new roman; font-size: 16px; ">Sent: Wednesday, July 25, 2007 11:36:22 PM</SPAN><BR style="font-family: times new roman; font-size: 16px; "><SPAN class="Apple-style-span" style="font-family: times new roman; font-size: 16px; ">Subject: binary protocol incr/decr proof-of-concept</SPAN><BR style="font-family: times new roman; font-size: 16px; "><BR style="font-family: times new roman; font-size: 16px; "><DIV style="font-family: times new roman; font-size: 16px; "><BR style="font-family: times new roman; font-size: 16px; "><SPAN class="Apple-style-span" style="font-family: times new roman; font-size: 16px; "> I've done an implementation of incr and decr in my test server and </SPAN><BR style="font-family: times new roman; font-size: 16px; "><SPAN class="Apple-style-span" style="font-family: times new roman; font-size: 16px; ">client (and my real client) as I'd described earlier as a sort of </SPAN><BR style="font-family: times new roman; font-size: 16px; "><SPAN class="Apple-style-span" style="font-family: times new roman; font-size: 16px; ">proof-of-concept and it seems to work as I was hoping it would.</SPAN><BR style="font-family: times new roman; font-size: 16px; "><BR style="font-family: times new roman; font-size: 16px; "><SPAN class="Apple-style-span" style="font-family: times new roman; font-size: 16px; "> It retains much of the properties of the original incr and decr </SPAN><BR style="font-family: times new roman; font-size: 16px; "><SPAN class="Apple-style-span" style="font-family: times new roman; font-size: 16px; ">implementations, but never treats the number as an ascii string. </SPAN><BR style="font-family: times new roman; font-size: 16px; "><SPAN class="Apple-style-span" style="font-family: times new roman; font-size: 16px; ">Because of this, I felt that it was important to be able to </SPAN><BR style="font-family: times new roman; font-size: 16px; "><SPAN class="Apple-style-span" style="font-family: times new roman; font-size: 16px; ">optionally pass a default value into the mutation command. Since a </SPAN><BR style="font-family: times new roman; font-size: 16px; "><SPAN class="Apple-style-span" style="font-family: times new roman; font-size: 16px; ">value was needed, it also seemed important to pass the expiration for </SPAN><BR style="font-family: times new roman; font-size: 16px; "><SPAN class="Apple-style-span" style="font-family: times new roman; font-size: 16px; ">that value.</SPAN><BR style="font-family: times new roman; font-size: 16px; "><BR style="font-family: times new roman; font-size: 16px; "><SPAN class="Apple-style-span" style="font-family: times new roman; font-size: 16px; "> Note that this does slightly conflict with the goal of keeping </SPAN><BR style="font-family: times new roman; font-size: 16px; "><SPAN class="Apple-style-span" style="font-family: times new roman; font-size: 16px; ">commands small and discrete since it may create a new mapping as a </SPAN><BR style="font-family: times new roman; font-size: 16px; "><SPAN class="Apple-style-span" style="font-family: times new roman; font-size: 16px; ">side-effect. However, I think it makes things a bit easier.</SPAN><BR style="font-family: times new roman; font-size: 16px; "><BR style="font-family: times new roman; font-size: 16px; "><SPAN class="Apple-style-span" style="font-family: times new roman; font-size: 16px; "> The request packet looks like this:</SPAN><BR style="font-family: times new roman; font-size: 16px; "><BR style="font-family: times new roman; font-size: 16px; "><SPAN class="Apple-style-span" style="font-family: times new roman; font-size: 16px; ">[normal packet stuff]</SPAN><BR style="font-family: times new roman; font-size: 16px; "><SPAN class="Apple-style-span" style="font-family: times new roman; font-size: 16px; ">[32-bit unsigned incr/decr amount]</SPAN><BR style="font-family: times new roman; font-size: 16px; "><SPAN class="Apple-style-span" style="font-family: times new roman; font-size: 16px; ">[32-bit unsigned default value]</SPAN><BR style="font-family: times new roman; font-size: 16px; "><SPAN class="Apple-style-span" style="font-family: times new roman; font-size: 16px; ">[32-bit signed expiration value]</SPAN><BR style="font-family: times new roman; font-size: 16px; "><SPAN class="Apple-style-span" style="font-family: times new roman; font-size: 16px; ">[key]</SPAN><BR style="font-family: times new roman; font-size: 16px; "><BR style="font-family: times new roman; font-size: 16px; "><SPAN class="Apple-style-span" style="font-family: times new roman; font-size: 16px; "> The response packet looks like this:</SPAN><BR style="font-family: times new roman; font-size: 16px; "><BR style="font-family: times new roman; font-size: 16px; "><SPAN class="Apple-style-span" style="font-family: times new roman; font-size: 16px; ">[32-bit unsigned new value]</SPAN><BR style="font-family: times new roman; font-size: 16px; "><BR style="font-family: times new roman; font-size: 16px; "><SPAN class="Apple-style-span" style="font-family: times new roman; font-size: 16px; "> If the expiration is less than 0, the default value is ignored and a </SPAN><BR style="font-family: times new roman; font-size: 16px; "><SPAN class="Apple-style-span" style="font-family: times new roman; font-size: 16px; ">NOT_FOUND status will be returned (as before).</SPAN><BR style="font-family: times new roman; font-size: 16px; "><BR style="font-family: times new roman; font-size: 16px; "><SPAN class="Apple-style-span" style="font-family: times new roman; font-size: 16px; "> I had implemented mutation with default in my client by using a sort </SPAN><BR style="font-family: times new roman; font-size: 16px; "><SPAN class="Apple-style-span" style="font-family: times new roman; font-size: 16px; ">of complicated combinations of mutate and add. I'm guessing other </SPAN><BR style="font-family: times new roman; font-size: 16px; "><SPAN class="Apple-style-span" style="font-family: times new roman; font-size: 16px; ">people either do the same thing (or worse, just a mutate or set).</SPAN><BR style="font-family: times new roman; font-size: 16px; "><BR style="font-family: times new roman; font-size: 16px; "><SPAN class="Apple-style-span" style="font-family: times new roman; font-size: 16px; "> Note that flags are undefined here. We talked briefly about having </SPAN><BR style="font-family: times new roman; font-size: 16px; "><SPAN class="Apple-style-span" style="font-family: times new roman; font-size: 16px; ">flags defined for common encoding mechanisms such as the big-endian </SPAN><BR style="font-family: times new roman; font-size: 16px; "><SPAN class="Apple-style-span" style="font-family: times new roman; font-size: 16px; ">32-bit unsigned integer used in this response (as would be retrieved </SPAN><BR style="font-family: times new roman; font-size: 16px; "><SPAN class="Apple-style-span" style="font-family: times new roman; font-size: 16px; ">using a normal ``get'' command). In the meantime, I've completely </SPAN><BR style="font-family: times new roman; font-size: 16px; "><SPAN class="Apple-style-span" style="font-family: times new roman; font-size: 16px; ">ignored the problem.</SPAN><BR style="font-family: times new roman; font-size: 16px; "><BR style="font-family: times new roman; font-size: 16px; "><SPAN class="Apple-style-span" style="font-family: times new roman; font-size: 16px; "> Comments?</SPAN><BR style="font-family: times new roman; font-size: 16px; "><BR style="font-family: times new roman; font-size: 16px; "><SPAN class="Apple-style-span" style="font-family: times new roman; font-size: 16px; ">-- </SPAN><BR style="font-family: times new roman; font-size: 16px; "><SPAN class="Apple-style-span" style="font-family: times new roman; font-size: 16px; ">Dustin Sallings</SPAN><BR style="font-family: times new roman; font-size: 16px; "><BR style="font-family: times new roman; font-size: 16px; "><BR style="font-family: times new roman; font-size: 16px; "></DIV></DIV><BR style="font-family: times new roman; font-size: 16px; "></DIV></DIV><BR><HR size="1">Be a better Globetrotter.<SPAN class="Apple-converted-space"> </SPAN><A href="http://us.rd.yahoo.com/evt=48254/*http://answers.yahoo.com/dir/_ylc=X3oDMTI5MGx2aThyBF9TAzIxMTU1MDAzNTIEX3MDMzk2NTQ1MTAzBHNlYwNCQUJwaWxsYXJfTklfMzYwBHNsawNQcm9kdWN0X3F1ZXN0aW9uX3BhZ2U-?link=list&sid=396545469"><SPAN class="Apple-style-span" style="color: rgb(0, 0, 238); -khtml-text-decorations-in-effect: underline; ">Get better travel answers </SPAN></A>from someone who knows.<BR>Yahoo! Answers - Check it out.</SPAN></BLOCKQUOTE></DIV><BR><DIV> <SPAN class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><DIV>-- </DIV><DIV>Dustin Sallings</DIV><BR class="Apple-interchange-newline"></SPAN> </DIV><BR></BODY></HTML>