updateAccessTime static method

Future<void> updateAccessTime(
  1. String url
)

Update access time for a file (marks it as recently used). Call this when a video is played to keep it in cache longer.

Implementation

static Future<void> updateAccessTime(String url) async {
  final path = await getFilePath(url);
  final file = File(path);
  if (file.existsSync()) {
    // Touch the file to update access time
    try {
      final now = DateTime.now();
      await file.setLastAccessed(now);
    } catch (_) {
      // Ignore if can't update access time
    }
  }
}