Incrementing by positive amounts will reach signed 64-bit max ( {@code 2^63 - 1}) and then wrap-around to signed 64-bit min ( {@code -2^63}), continuing increments from that point.
To facilitate use as an atomic countdown, incrementing by a negative value (i.e. decrementing) will not go below zero: incrementing {@code 2} by{@code -5} will return {@code 0}, not {@code -3}.
Note: The actual representation of all numbers in Memcache is a string. This means if you initially stored a number as a string (e.g., "10") and then increment it, everything will work properly.
When you {@link #get(Object)} a key for a string value, wrapping occursafter exceeding the max value of an unsigned 64-bit number ( {@code 2^64 - 1}). When you {@link #get(Object)} a keyfor a numerical type, wrapping occurs after exceeding the type max value. @param key the key of the entry to manipulate @param delta the size of the increment, positive or negative @return the post-increment value, as a long. However, a{@link #get(Object)} of the key will still have the original type ({@link Byte}, {@link Short}, etc.). If there is no entry for {@code key}, returns {@code null}. @throws IllegalArgumentException if {@code key} is not{@link Serializable} and is not {@code null} @throws InvalidValueException if the object incremented is not of aintegral type or holding a negative value
|
|
|
|
|
|