Check cache parameters

This commit is contained in:
laurenspriem
2025-08-21 11:54:10 +05:30
parent e824c02d7f
commit 99c0194c0f

View File

@@ -95,12 +95,19 @@ class SimilarImagesService {
final Set<int> cachedFileIDs = cachedData.allCheckedFileIDs;
final currentFileIDs = fileIDs.toSet();
// Check condition 1: New files > 20% of total files
final newFileIDs = currentFileIDs.difference(cachedFileIDs);
if (newFileIDs.length > currentFileIDs.length * 0.2) {
if (cachedData.distanceThreshold != distanceThreshold ||
cachedData.exact != exact) {
needsFullRefresh = true;
}
// Check condition 1: New files > 20% of total files
if (!needsFullRefresh) {
final newFileIDs = currentFileIDs.difference(cachedFileIDs);
if (newFileIDs.length > currentFileIDs.length * 0.2) {
needsFullRefresh = true;
}
}
// Check condition 2: 20+% of grouped files deleted
if (!needsFullRefresh) {
final Set<int> cacheGroupedFileIDs =