invalidateWhere static method
Remove all entries whose key contains pattern.
Useful for invalidating a whole endpoint family e.g. /v1/brands.
Implementation
static Future<void> invalidateWhere(String pattern) async {
final memKeys = _memory.keys.where((k) => k.contains(pattern)).toList();
for (final k in memKeys) {
_memory.remove(k);
}
final hiveKeys =
_box?.keys.where((k) => k.toString().contains(pattern)).toList() ?? [];
for (final k in hiveKeys) {
await _box?.delete(k);
}
}