Why would you *want* a wraparound when incrementing?<br>Quite the opposite for me, I do not want it to wrap around, because then I would require additional code to check that.&nbsp; Right now, very simply... if my increment fails, I reset all the data that is associated with that key, and start again.&nbsp; 
<br><br>Although, it is possible that treat a &#39;0&#39; returned as a wrap failure in your scenario, it is easier for me to treat the wrap error the same as if the key had expired, or the service had been restarted, causing me to replenish the data that appears to be missing.
<br><br><div><span class="gmail_quote">On 8/17/07, <b class="gmail_sendername">Evan Miller</b> &lt;<a href="mailto:emiller@imvu.com">emiller@imvu.com</a>&gt; wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Currently Memcached gives an error when incrementing large counters:<br><br>set foobar 0 0 10<br>2147483647<br>STORED<br>incr foobar 1<br>2147483648<br>incr foobar 1<br>CLIENT_ERROR cannot increment or decrement non-numeric value
<br><br>I believe this is a bug. Attached is a patch to make counters wrap<br>around the 2**32 mark, similar to counters in routers. New behavior:<br><br>set foobar 0 0 10<br>4294967294<br>STORED<br>incr foobar 1<br>4294967295
<br>incr foobar 1<br>0<br><br>A CLIENT_ERROR will continue to be returned if a value above 2**32 is<br>incremented, but the &quot;incr&quot; command will never push the value over that<br>mark.<br><br>A future version of Memcached should probably use a 64-bit counter
<br>instead, but the 32-bit limit is in line with the existing docs. (&quot;The<br>data for the item is treated as decimal representation of a 32-bit<br>unsigned integer.&quot;)<br><br>The patch also adds &quot;const&quot; keywords to arguments of do_add_delta and
<br>mt_add_delta, to be consistent with the header file.<br><br>Documentation and tests have been updated.<br><br>Evan Miller<br>IMVU, Inc.<br><br></blockquote></div><br><br clear="all"><br>-- <br>&quot;Be excellent to each other&quot;