Notice: Over the next few months, we're reorganizing the App Engine documentation site to make it easier to find content and better align with the rest of Google Cloud products. The same content will be available, but the navigation will now match the rest of the Cloud products.

Python 3.10 is now available in preview.

google.appengine.api.memcache.decr

Atomically decrements a key's value.

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.

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.

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.

ValueError If number is negative.
TypeError If delta isn't an int or long.