initialize method

Future<void> initialize()

Implementation

Future<void> initialize() async {
  try {
    final file = File(cachePath);
    if (await file.exists()) {
      final content = await file.readAsString();
      final data = jsonDecode(content) as Map<String, dynamic>;

      data.forEach((key, value) {
        _cache[key] = CacheEntry.fromJson(value);
      });
    }
  } catch (e) {
    print('Warning: Failed to load cache: $e');
  }
}