decrement method
Decrements the value of the number stored at the key by the decrement amount. If decrement amount not specified, decrements the number stored at key by one. If the key does not exist, it is set to 0 before performing the operation. If ttl specified, sets the stored entry to automatically expire in specified seconds. Any previous time to live associated with the key is discarded on successful decrement operation.
If the client library key is set to enforce session, an active user session is required (e.g., user needs to be logged in) to call this method.
key
The key to decrement
decrement The amount to decrement the value by. Default 1
ttl
Time to live in seconds
Returns the value of key after the decrement
Implementation
Future<APIResponse<Map<String, dynamic>>> decrement(String key,
{int decrement = 1, int? ttl}) =>
_fetcher.post<Map<String, dynamic>>('/_api/rest/v1/cache/decrement',
body: {
'key': key,
'decrement': decrement,
if (ttl != null) 'ttl': ttl
});