getExpiredKeys method
Streams all keys that have expired. The returned Future
completes once the backend has accepted the request (surfacing
any setup failure eagerly); the Stream then yields the keys.
Implementation
@override
Future<Stream<String>> getExpiredKeys() async {
// Answered from _expiryIndex — _effectiveExpiry(n) < now is
// exactly n.isExpired(), without deserialising every entry.
final now = DateTime.timestamp();
final expiredKeys = <String>[];
_expiryIndex.forEach((key, expiry) {
if (expiry.isBefore(now)) {
expiredKeys.add(Utf7.encode(key));
}
});
return Stream.fromIterable(expiredKeys);
}