expire method

Future<APIError?> expire(
  1. String key,
  2. int ttl
)

Sets a timeout on key. After the timeout has expired, the key will automatically be deleted.

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 set its expiry duration

ttl Time to live in seconds

Implementation

Future<APIError?> expire(String key, int ttl) async =>
    (await _fetcher.post<dynamic>('/_api/rest/v1/cache/expire',
            body: {'key': key, 'ttl': ttl}))
        .errors;