Here's another odd point on INCR/DECR ...

The default engine will not decrement an item to less than zero.
The "binary decr" test in memcapable also asserts that you can't do that. There's a comment:

  /* decr 0 should not wrap */

But the spec on the wiki also doesn't mention anything one way or the other about that.


JD



On Mar 4, 2011, at 7:01 AM, Trond Norbye wrote:


On 3. mars 2011, at 23.10, Dustin wrote:


On Mar 2, 9:13 pm, Jason Sirota <[email protected]> wrote:
In reading the binary spec documenthttp://code.google.com/p/memcached/wiki/BinaryProtocolRevampedit isn't
clear that the value to be incremented/decremented must be the char
representation of a number (0x31 for 1 for example) rather than an integer representation (e.g. 0x00 00 00 01) even though the step value and initial value are represented by unsigned long integers. Took me a while to figure
out what was going on.

This makes sense, though it's not binary protocol specific.

The binary protocol has the advantage of managing the creation,
modification, and retrieval of the value abstractly.  Ideally, you
wouldn't set the value independently of the incr or decr commands.

I just updated the page with a comment.

Trond


Reply via email to