reduceCacheSize function
Implementation
Future<void> reduceCacheSize(GetStorage getStorage, List<CachedMediaInfo> allCachedMediaInfo) async {
if (allCachedMediaInfo.isNotEmpty) {
allCachedMediaInfo.sort((a, b) => a.dateCreated.compareTo(b.dateCreated));
final a = allCachedMediaInfo.first;
if (getShowLogs) {
developer.log("🧽 Clearing cache from ${a.cachedMediaUrl}", name: 'Cached Media package');
}
await deleteMediaInCache(a.cachedMediaUrl);
removeCachedMediaInfo(getStorage, a.id);
}
}