set method
Sets an item in the cache. Overwrites any existing value already set. 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 set 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 update
value
The value to set
ttl
Time to live in seconds
Implementation
Future<APIError?> set(String key, Object value, [int? ttl]) async =>
(await _fetcher.post<dynamic>('/_api/rest/v1/cache',
body: {'key': key, 'value': value, if (ttl != null) 'ttl': ttl}))
.errors;