notReferencedByAnyRequests method

  1. @visibleForTesting
Future<Set<String>> notReferencedByAnyRequests(
  1. Set<String> keys
)

Returns the subset of keys that are not referenced by any requests in the cache. This is used to detect whether keys orphaned by a specific write are in fact globally orphaned and should be deleted, or should merely be deleted from that specific request.

Implementation

@visibleForTesting
Future<Set<String>> notReferencedByAnyRequests(Set<String> keys) async {
  final allCachedRequests = await _requestCache.readAll();
  final referencedKeys = <String>{};
  allCachedRequests.values.forEach(referencedKeys.addAll);
  return keys.difference(referencedKeys);
}