save method

Future<void> save()

Implementation

Future<void> save() async {
  try {
    final file = File(cachePath);
    final data = _cache.map(
      (key, value) => MapEntry(key, value.toJson()),
    );

    await file.writeAsString(jsonEncode(data));
  } catch (e) {
    print('Warning: Failed to save cache: $e');
  }
}