<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:times new roman, new york, times, serif;font-size:12pt"><div style="font-family: times new roman,new york,times,serif; font-size: 12pt;">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.<br><br>Thoughts?<br><br>Earl<br><br><div style="font-family: times new roman,new york,times,serif; font-size: 12pt;">----- Original Message ----<br>From: Dustin Sallings <dustin@spy.net><br>To: Memcached list <memcached@lists.danga.com><br>Sent: Wednesday, July 25, 2007 11:36:22 PM<br>Subject: binary protocol incr/decr proof-of-concept<br><br><div><br> I've done an implementation of incr and decr in my test server
and <br>client (and my real client) as I'd described earlier as a sort of <br>proof-of-concept and it seems to work as I was hoping it would.<br><br> It retains much of the properties of the original incr and decr <br>implementations, but never treats the number as an ascii string. <br>Because of this, I felt that it was important to be able to <br>optionally pass a default value into the mutation command. Since a <br>value was needed, it also seemed important to pass the expiration for <br>that value.<br><br> Note that this does slightly conflict with the goal of keeping <br>commands small and discrete since it may create a new mapping as a <br>side-effect. However, I think it makes things a bit easier.<br><br> The request packet looks like this:<br><br>[normal
packet stuff]<br>[32-bit unsigned incr/decr amount]<br>[32-bit unsigned default value]<br>[32-bit signed expiration value]<br>[key]<br><br> The response packet looks like this:<br><br>[32-bit unsigned new value]<br><br> If the expiration is less than 0, the default value is ignored and a <br>NOT_FOUND status will be returned (as before).<br><br> I had implemented mutation with default in my client by using a sort <br>of complicated combinations of mutate and add. I'm guessing other <br>people either do the same thing (or worse, just a mutate or set).<br><br> Note that flags are undefined here. We talked briefly about having <br>flags defined for common encoding mechanisms such as the big-endian <br>32-bit unsigned integer used in this response (as would be retrieved <br>using
a normal ``get'' command). In the meantime, I've completely <br>ignored the problem.<br><br> Comments?<br><br>-- <br>Dustin Sallings<br><br><br></div></div><br></div></div><br>
<hr size=1>Be a better Globetrotter. <a href="http://us.rd.yahoo.com/evt=48254/*http://answers.yahoo.com/dir/_ylc=X3oDMTI5MGx2aThyBF9TAzIxMTU1MDAzNTIEX3MDMzk2NTQ1MTAzBHNlYwNCQUJwaWxsYXJfTklfMzYwBHNsawNQcm9kdWN0X3F1ZXN0aW9uX3BhZ2U-?link=list&sid=396545469">Get better travel answers </a>from someone who knows.<br>Yahoo! Answers - Check it out.
</body></html>