getMatchingKeys method
Returns all query keys matching filter across active queries and cached entries.
Implementation
List<String> getMatchingKeys(ZenQueryFilter filter) {
final allKeys = <String>{..._queries.keys, ..._cache.keys};
final matchingKeys = <String>[];
for (final key in allKeys) {
final query = _queries[key];
if (query != null) {
if (filter.matches(query)) {
matchingKeys.add(key);
}
} else {
// Cache-only entry (not mounted as active ZenQuery)
final tags = _getTagsForKey(key);
final entry = _cache[key];
final isStale = entry == null || entry.isExpired;
if (filter.matchesKeyAndTags(
key,
queryTags: tags,
queryIsStale: isStale,
queryIsFetching: false,
)) {
matchingKeys.add(key);
}
}
}
return matchingKeys;
}