updateStats method

  1. @override
void updateStats(
  1. String driverName, {
  2. required bool hit,
  3. required String operation,
  4. bool error = false,
})
override

Updates statistics for a cache operation.

Implementation

@override
void updateStats(
  String driverName, {
  required bool hit,
  required String operation,
  bool error = false,
}) {
  final currentStats = _getOrCreateStats(driverName);

  if (operation == 'get' || operation == 'has') {
    if (hit) {
      currentStats.hits++;
    } else {
      currentStats.misses++;
    }
  } else if (operation == 'put') {
    currentStats.sets++;
  } else if (operation == 'forget') {
    currentStats.deletions++;
  } else if (operation == 'clear') {
    currentStats.clears++;
  }

  // Note: CacheStats doesn't have an errors field, so we skip error tracking for now
  // This could be added to CacheStats if needed in the future
}