increment method
Increments the value of the number stored at the key by the increment amount. If increment amount not specified, increments 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 increment 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 increment
increment The amount to increment the value by. Default 1.
ttl
Time to live in seconds
Returns the value of key after the increment
Implementation
Future<APIResponse<Map<String, dynamic>>> increment(String key,
{int increment = 1, int? ttl}) =>
_fetcher.post<Map<String, dynamic>>('/_api/rest/v1/cache/increment',
body: {
'key': key,
'increment': increment,
if (ttl != null) 'ttl': ttl
});