delete method

Future<APIError?> delete(
  1. dynamic keys
)

Removes the specified key(s) from the cache. Irrespective of whether the key is found or not, success response is returned.

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.

keys A single string key or an array of keys (string) to delete

Implementation

Future<APIError?> delete(dynamic keys) async {
  if (!(keys is String || keys is List<String>)) {
    throw Exception('[keys] must be string or List<String>');
  }

  return (await _fetcher.delete<dynamic>('/_api/rest/v1/cache', body: {
    'keys': keys is List ? keys : [keys.toString()],
  }))
      .errors;
}