Internally, the value is a unsigned 64-bit integer. Memcache
caps decrementing below zero to zero.
The key must already exist in the cache to be decremented. See
docs on incr() for details.
Args
key
Key to decrement. If an iterable collection, each one of the keys
will be offset. See Client's docstring for details.
delta
Non-negative integer value (int or long) to decrement key by,
defaulting to 1.
namespace
a string specifying an optional namespace to use in
the request.
initial_value
initial value to put in the cache, if it doesn't
already exist. The default value, None, will not create a cache
entry if it doesn't already exist.
Returns
If key was a single value, the new long integer value, or None if key
was not in the cache, could not be decremented for any other reason, or
a network/RPC/server error occurred.
If key was an iterable collection, a dictionary will be returned
mapping supplied keys to values, with the values having the same meaning
as the singular return value of this method.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2023-11-14 UTC."],[[["The `decr()` function atomically decrements the value of a specified key in the memcache, where the value is treated as an unsigned 64-bit integer and cannot go below zero."],["To successfully decrement a key using `decr()`, the key must already exist within the cache; otherwise, the method returns None."],["The `delta` parameter specifies the non-negative integer amount by which to decrement the key's value, with a default value of 1."],["The function can operate on a single key or a collection of keys, returning either the new decremented value or a dictionary of key-value pairs, respectively."],["The `decr()` method can raise a `ValueError` if a negative number is used as a `delta`, or a `TypeError` if the `delta` is not an integer."]]],[]]