invalidateCachedStatisticsAsync method

Future<void> invalidateCachedStatisticsAsync({
  1. List<String>? statTypes = const ['length', 'size'],
})

Remove the cached statistics asynchronously

For synchronous version, see invalidateCachedStatistics.

statTypes dictates the types of statistics to remove, defaulting to only 'length' and 'size'. Set to null to remove all types.

Implementation

Future<void> invalidateCachedStatisticsAsync({
  List<String>? statTypes = const [
    'length',
    'size',
  ],
}) async {
  try {
    await Future.wait(
      (statTypes ??
              [
                'length',
                'size',
                'cacheHits',
                'cacheMisses',
              ])
          .map((e) => (_access.stats >>> '$e.cache').delete()),
    );
    // ignore: empty_catches
  } catch (e) {}
}