Hi all,

I am trying to use memcache.increment to move to negative values,
starting at 0. According to the javadoc[1]:

"To facilitate use as an atomic countdown, incrementing by a negative
value (i.e. decrementing) will not go below zero: incrementing 2 by -5
will return 0, not -3. However, due to the way numbers are stored,
decrementing -3 by -5 will result in -8; so the zero-floor rule only
applies to decrementing numbers that were positive."

What is the rationale behind this, and why is 0 considered positive? I
may have missed something, but I did not understand a similar behavior
in python's memcache.decr() docs. If my counter can hold positive or
negative values, what options do I have apart from initializing at
2^30?

-- Nacho

[1]
http://code.google.com/appengine/docs/java/javadoc/com/google/appengine/api/memcache/MemcacheService.html#increment(java.lang.Object,%20long)

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine for Java" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.

Reply via email to