updateCache method

Future<void> updateCache(
  1. String filePath, {
  2. String? priority,
  3. List<Map<String, dynamic>>? issues,
})

Implementation

Future<void> updateCache(
  String filePath, {
  String? priority,
  List<Map<String, dynamic>>? issues,
}) async {
  if (!context.config.cacheEnabled || !_initialized) return;

  final file = File(p.join(context.directory, filePath));
  if (await file.exists()) {
    final stat = await file.stat();
    final hash = await _calculateHash(file);

    _cache[filePath] = {
      'timestamp': stat.modified.millisecondsSinceEpoch,
      'hash': hash,
      'priority': ?priority,
      if (issues != null && issues.isNotEmpty) 'issues': issues,
    };
  } else {
    _cache.remove(filePath);
  }
}