PrfActivityCounter constructor

PrfActivityCounter(
  1. String key, {
  2. bool useCache = false,
  3. DateTime clock()?,
})

Creates a new instance of PrfActivityCounter with the given key.

The useCache parameter determines whether to use cached values for performance optimization. The clock parameter allows for custom time sources, defaulting to DateTime.now.

Implementation

PrfActivityCounter(
  String key, {
  super.useCache,
  DateTime Function()? clock,
})  : _clock = clock ?? DateTime.now,
      _data = {
        for (final span in ActivitySpan.values)
          span: Prf<List<int>>('${_keyPrefix}_${key}_${span.keySuffix}')
      };