invalidateCachedStatistics method

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

Remove the cached statistics synchronously

For asynchronous version, see invalidateCachedStatisticsAsync.

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

Implementation

void invalidateCachedStatistics({
  List<String>? statTypes = const [
    'length',
    'size',
  ],
}) =>
    (statTypes ??
            [
              'length',
              'size',
              'cacheHits',
              'cacheMisses',
            ])
        .map((e) => _access.stats >>> '$e.cache')
        .forEach((e) => e.existsSync() ? e.deleteSync() : null);