getFileFromCache method
Get the file from the cache.
Implementation
@override
Future<FileInfo?> getFileFromCache(
String key, {
bool ignoreMemCache = false,
}) async {
await _ensureInitialized();
final raw = _cacheBox!.get(key);
if (raw == null) return null;
final metadata = CacheEntryMetadata.fromMap(raw);
final filePath = _cacheFilePath(metadata.relativePath);
final file = io.File(filePath);
if (!file.existsSync()) {
// Metadata exists but file is missing, clean up
await _cacheBox!.delete(key);
return null;
}
final localFile = const LocalFileSystem().file(filePath);
return FileInfo(
localFile, FileSource.Cache, metadata.validTill, metadata.url);
}