clearAllLocalData method

  1. @override
Future<void> clearAllLocalData()
override

Removes every blob and its metadata, pinned ones included.

The cache stays usable afterwards. Idempotent: clearing an empty cache is a no-op.

Implementation

@override
Future<void> clearAllLocalData() async {
  final db = _required;
  await _serialized(() async {
    await _meta.delete(db);
    // Temp files of puts still waiting their turn are kept.
    for (final entity in await _blobs.list(followLinks: false).toList()) {
      if (_keyPattern.hasMatch(p.basename(entity.path))) {
        await entity.delete(recursive: true);
      }
    }
  });
}